Forums

Upload file -> on fail

wydo 26 Aug, 2015
Hello,

I have a problem with a form.

There is a file to upload with a size limit of 1 Mb.
In the "on fail" event I've selected Target event = OnLoad
and
quit next actions = yes

The error message about th size is diplayed.

BUT, in the url, the following is added : "&event=submit" , and so, if I change nothing (file is too big) but I press enter in the url box, the form is submitted empty.

Could you please help me ?

Best regards

wydo
GreyHead 26 Aug, 2015
Hi wydo,

The form is being submitted if you press enter in the URL box? Are you using IE? If so you can prevent this behaviour - see this doc.

Bob
wydo 26 Aug, 2015
I'm using Chrome...

I'm not familiar with the code you send me😟

I'm working for an association (as a volunteer), difficult to find my way. Here is the link to the form, that is announced to go live on sep 1st :
http://www.concoursgrumiaux.be/index.php/fr/?option=com_chronoforms&chronoform=Inscription_EN

If you submit the form, with a pic file bigger than 1Mo, it gives an error message. But then, in the url form, the "&event=submit" is added at the end of the url, and if there you press enter in the url, it is submitting the form with all empty fields.

The problem is that this form is a registration to an international violin competition, and last year we received several empty forms, fearing that maybe we're missing some registrations in a very tight schedule😟

I'll inscrease the max size of the file, but if I could find the bug here, I would feel much more comfortable....
GreyHead 28 Aug, 2015
Hi wydo,

The quick solution to this is to use serverside validation to block any forms where the required inputs are empty. I'm a bit puzzled though about why the inputs aren't being re-populated on an error. Normally they are (apart from file inputs which can’t be).

Bob
wydo 28 Aug, 2015
Hello Greyhead, thank you for your response.

Actually, the fields are repopulated (except the dynamic select boxes). So on the screen, it seems it is populated, and if you press enter in the url bar, it is submitting the form, with empty fields. Feel free to make a try on the url form I sent earlier.
wydo 28 Aug, 2015
So, the behavior is the same in Firefox and chrome. The problem comes from the url that is rebuilt after the validation, why is it adding that http://www.concoursgrumiaux.be/index.php/fr/?option=com_chronoforms&chronoform=Inscription_EN&event=submit at the end ?
Because then, if you place the cursor in the url box and press enter, no more validation occurs, and form is sent empty....

Thank you for your help
GreyHead 29 Aug, 2015
Hi Wydo,

The &event=submit is added to the URL because that identifies the form event that handles the submission. You may be right that it should be removed on reload - I've had a quick look at the code but can't work out where the change would need to be.

I still believe that the simplest was to handle this is to add server-side validation.

Bob
wydo 30 Aug, 2015
Hi Greyhead,

Thanks a lot for your response (and your try). Actually, I tried to add a custom server side validation but I think it may be a bug, that is going above this server side validation.

The mail I received after your try was like this :

Formulaire d'inscription
Nom {input_nom}
Prénom {input_prenom}
Rue / N° {input_rue}
N° {input_no}
CP / Localité {input_cp}
Localité {input_loc}
Pays {input_pays} -
Nationalité {input_nationalite} -
Téléphone {input_tel}
GSM {input_gsm}
E-mail {input_mail}
Date de naissance {input_datenaiss}
Ecole de musique {input_ecole}
Nom du professeur {input_prof}



while, I guess, at the screen all the fields were populated.

I've added the following custom server side validation :

<?php
$error_count = 0;

if ( empty ($form->data['input_mail'] ) ) {
$error_count++;
$form->validation_errors['input_mail'] = "Veuillez remplir le mail" ;
}

if ( $form->data['input_mail'] =='{input_mail}' ) {
$error_count++;
$form->validation_errors['input_mail'] = "Veuillez remplir le mail" ;
}

if ( strpos($form->data['input_mail'], '@' ) !== false {
$error_count++;
$form->validation_errors['input_mail'] = "Veuillez remplir le mail 2" ;
}

if ( $error_count  ) {
return false;
}
?>


but I have the same behavior, I'm still able to submit the form when pressing enter in the url bar.

If you have any other idea how to prevent from this, it would really help me :-/

thanks a lot !!

wydo
GreyHead 31 Aug, 2015
Hi wydo,

This line is missing a ) so the validation will fail.
if ( strpos($form->data['input_mail'], '@' ) !== false {

Bob
This topic is locked and no more replies can be posted.