PDA

View Full Version : Use Spry Validation with jQuery Form to Form Wizard (v1.1)



dreamwuser
12-08-2011, 04:53 PM
1) Script Title: jQuery Form to Form Wizard (v1.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/formwizard.htm

3) Describe problem:

I'd like to use Dreamweaver's SPRY validation with this script. I created the form with Spry fields and implemented the Form Wizard script. I spry validate on Blur and submit and that works fine, but I want to prevent user from moving on to next section if fields have spry errors.

How can I use onpagechangestart function to prevent user from going to next section?

ddadmin
12-09-2011, 01:10 PM
I'm not familiar with Spry Validation specifically; does the script return a value of false (or some other indicator) when a field fails a validation test? In general when you return a value of false inside the onpagechangestart() function of Form Wizard, it halts the user from proceeding to another form page until a value of true is returned instead. The later two examples on the supplementary page shows this in action: http://www.dynamicdrive.com/dynamicindex16/formwizard_suppliment.htm

dreamwuser
12-09-2011, 05:28 PM
I believe Spry widgets do return false. I pulled this code from one of the widgets where I think Spry checks for false onSubmit.

if (!Spry.Widget.Form.onSubmit) {
Spry.Widget.Form.onSubmit = function(e, form)
{
if (Spry.Widget.Form.validate(form) == false) {
return false;
}
return true;
};
};

dreamwuser
01-05-2012, 11:57 PM
onpagechangestart:function($, i, $fieldset){
if ( Spry.Widget.Form.validate(form1) == true ){
alert("This is validated");
return true;
}
else
{
alert("This is not validated");
return false;
}

}