Jan 29th, 2010, 2:24 PM
I have tryed to get JS validation working on my forms but all that happens when I click submit is the alert box pops up telling me what to fix and then if I just click submit again without fixing anything the form passes validation and gets submitted.
There must be a trick that I am missing. I followed the documentation and it validates once then if you just submit the form a second time, the form just submits without running the validation.
How do you "reset" the form so that it will run the validation each time it gets submitted?
Here are my rules.
var rules = [];
rules.push("required,year,Please enter the year of your car.");
rules.push("required,make,Please enter the make of your car.");
rules.push("required,model,Please enter the model of your car.");
rules.push("required,body,Please enter the body style of your car.");
rules.push("required,name,Please enter your name.");
rules.push("required,work_phone,Please enter your work phone.");
rules.push("required,home_phone,Please enter your home phone.");
rules.push("required,city,Please enter your city.");
rules.push("required,email,Please enter your email address.");
rules.push("valid_email,email,Please enter a valid email address.");
rules.push("required,claim,Are you going to file an insurance claim?.");
rsv.errorFieldClass = null;
rsv.customErrorHandler = null;
rsv.displayType = "alert-all";
Here is my form "action":
<form action="<?php echo FORM_PROCESSOR; ?>" method="POST" onsubmit="return rsv.validate(this, rules)">
(the PHP code allows me to run the same form on mutiple machines without hard coding the path to the Form Processor application)
Please let me know if you have any ideas as I am now way behind schedule with the project of getting our forms to work with your Form Processor application.
There must be a trick that I am missing. I followed the documentation and it validates once then if you just submit the form a second time, the form just submits without running the validation.
How do you "reset" the form so that it will run the validation each time it gets submitted?
Here are my rules.
var rules = [];
rules.push("required,year,Please enter the year of your car.");
rules.push("required,make,Please enter the make of your car.");
rules.push("required,model,Please enter the model of your car.");
rules.push("required,body,Please enter the body style of your car.");
rules.push("required,name,Please enter your name.");
rules.push("required,work_phone,Please enter your work phone.");
rules.push("required,home_phone,Please enter your home phone.");
rules.push("required,city,Please enter your city.");
rules.push("required,email,Please enter your email address.");
rules.push("valid_email,email,Please enter a valid email address.");
rules.push("required,claim,Are you going to file an insurance claim?.");
rsv.errorFieldClass = null;
rsv.customErrorHandler = null;
rsv.displayType = "alert-all";
Here is my form "action":
<form action="<?php echo FORM_PROCESSOR; ?>" method="POST" onsubmit="return rsv.validate(this, rules)">
(the PHP code allows me to run the same form on mutiple machines without hard coding the path to the Form Processor application)
Please let me know if you have any ideas as I am now way behind schedule with the project of getting our forms to work with your Form Processor application.