Forums

validation problem

labbyjoel 12 Oct, 2012
HI!

I'm using 3 forms in one website.

2 of them work without any problem, but the validation of a new form ( not yet online ) doesn't work as needed.

All the fields are required, but only 2 of them (first one and captcha) are asked if empty? All other are accepted as valid.

The form is visible here : http://www.lescopainsdabord.be/index.php?option=com_chronoforms&chronoform=reservations

I didn't understand why this arrives only on this form.

A saw in the forum that many problems arrives when jquery is used by another plugin, but it's not the case here.

I'm using Joomla 2.5.1, Chronoform 4.0 RC3.11

thanks for your help !

Attached is the archive of the 3 forms.[attachment=0]CFV4_FormsBackup_ON_www.lescopainsdabord.be_13_Oct_2012_00_41_25.cf4bak.zip[/attachment]
GreyHead 13 Oct, 2012
Hi labbyjoel,

Actually all of the validations work except for the date-time picker. That one breaks the validation and allows the form to submit. If you add a date then the remaining validations are OK.

The datetime picker has a class that looks like this
class="validate['required','target:input_datetime_2_clone_id'] cf_date_picker"

I think that the problem is that the target part which is used by the datepicker is inside the validate[]. I'm not clear why that is, I'll take a look at the code later.

Bob
GreyHead 18 Oct, 2012
Hi labbyjoel,

The problem is with the DatePicker code. If I switch to the MooTools DatePicker on the form General tab the error goes away.

But the standard MooTools datepicker doesn't support the 'weekdays' option :-( I have a modified version that does include that option. Please unzip the attached file and copy the Picker.Date.js file to the components/com_chronoforms/js/datepicker_moo folder (I suggest that you rename the old version first as backup).

Bob
GreyHead 21 Oct, 2012
Hi Joe,

It looks to me as though it now fails when the lunch/dinner option is hidden. If you set a date then the rest of the validation including the now un-hidden inputs works OK.

The problem may be that the validation breaks on hidden inputs like this. Try disabling them as well; that also disables the validation and it will be re-enabled when they are displayed.

Bob
GreyHead 21 Oct, 2012
Hi Joe,

I agree - it's linked somehow to the date input but as there are no error messages it's not easy to spot the problem. Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look. I have a test site here set up using the non-compressed version of the FormCheck code that makes it easier to debug.

Bob
labbyjoel 21 Oct, 2012
Here is the backup of 2 forms. Thanks for your help !!

[attachment=0]CFV4_FormsBackup_ON_www.lescopainsdabord.be_21_Oct_2012_16_14_28.cf4bak.zip[/attachment]
GreyHead 25 Oct, 2012
Hi labbyjoel,

I've struggled with this but think I have found the problem. There's a bug in the ChronoForms code which only shows up when you validate a MooTools date-picker.

The previous MonkeyPhysics datepicker created a clone of the datepicker input and moved the original off the page. Max added validation code to set the 'target' to the clone and apply the validation to that so the error bubble wasn't set off the page.

The MooTools datepicker doesn't create a clone in the same way so the JavaScript was failing when it tried to apply the validation to the non-existent input.

I've worked out a fix which goes in the \components\com_chronoforms\js\formcheck\formcheck-max.js file. Look for this code around lines 12-13
		//determine position
		var coord = obj.target ? $(obj.target).getCoordinates() : obj.getCoordinates();
and replace it with this
		//determine position
		var coord;
		if(obj.target && typeOf($(obj.target)) != 'null') {
			coord = $(obj.target).getCoordinates();
		} else {
			coord = obj.getCoordinates();
		}

Although it looks longer the change is mostly that it now checks that the target input exists.

I'll link this post to the current bugs list.

Bob
labbyjoel 25 Oct, 2012
Yeah !!

I've updated the code on the website and it seem's to works very well now !

I'm able not to put this form in production !

Thanks a lot for your work !!

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