I have tried and tried to get this to work but it just won't validate. I had no trouble with the old version using the validation.js file but for some reason the rsv.js file just doesn't work.
I have followed the tutorials several times and just can't find my mistake. I have attached my file maybe someone can tell me what I am doing wrong.
var rules = [];
rules.push("required,name,Please enter your name.");
rules.push("required,email,Please enter your e-mail address.");
rules.push("valid_email,email,Please enter a valid email address.");
</script>
My form is submitting with the action onsubmit="return rsv.validate(this, rules)"
Jul 4th, 2009, 11:02 AM (This post was last modified: Jul 4th, 2009, 11:03 AM by Ben.)
Hey Terry,
Sorry - I can see why this is leading to confusion. I actually made a couple of modifications to the rsv.js script that's bundled with Form Tools to reduce the amount of redundancy in my own code. Form Tools uses RSV on virtually every page, and in most cases uses a custom error handler (the rsv.customErrorHandler option) to display the error messages in the page. This has been hardcoded into the rsv.js file, so it won't work unless you explicitly override it to null in your own pages.
// these lines are required if you're using the rsv.js file that's bundled with Form Tools.
// They reset the custom handlers defined in the file
rsv.errorFieldClass = null;
rsv.customErrorHandler = null;
rsv.displayType = "alert-all";
But that *really* isn't very clear.... erk! I'll put a big proviso on the first page of the tutorial to make this clearer.
Sorry - I can see why this is leading to confusion. I actually made a couple of modifications to the rsv.js script that's bundled with Form Tools to reduce the amount of redundancy in my own code. Form Tools uses RSV on virtually every page, and in most cases uses a custom error handler (the rsv.customErrorHandler option) to display the error messages in the page. This has been hardcoded into the rsv.js file, so it won't work unless you explicitly override it to null in your own pages.
// these lines are required if you're using the rsv.js file that's bundled with Form Tools.
// They reset the custom handlers defined in the file
rsv.errorFieldClass = null;
rsv.customErrorHandler = null;
rsv.displayType = "alert-all";
But that *really* isn't very clear.... erk! I'll put a big proviso on the first page of the tutorial to make this clearer.
Sorry, guys.
- Ben
Ben,
Your tutorial is flawless ...but I'm in the same trouble as Terry above and the OP: I'm following your instructions to the letter, yet JS validation is simply not working. No errors... it's simply not coming into play.
Like Terry, I resolved the problem with a simple workaround: I downloaded the standard version of RSV from BenjaminKeen.com and put it to work independently from the rsv file bundled with FT ...and voila! Trouble-free validation!
Please take a look at the bundled version for the source of the trouble we're having.
I found the problem: the Form Tools-bundled RSV script has a hardcoded reference to a g_rsvErrors function. That'll throw an error if it's not defined.