validation problem

labbyjoel 12 Oct, 2012

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 :

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][/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.

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).

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.

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.

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

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.getCoordinates();
and replace it with this
		//determine position
		var coord;
		if( && typeOf($( != 'null') {
			coord = $(;
		} 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.

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 !!

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