The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Form Validation not working - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Form Validation: JS + PHP (https://forums.formtools.org/forumdisplay.php?fid=18) +--- Thread: Form Validation not working (/showthread.php?tid=125) |
Form Validation not working - sogreen - Apr 22nd, 2009 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. RE: Form Validation not working - alrioart - Jul 3rd, 2009 I have the same problem. This is in my head: <script type="text/javascript" src="http://mydomainname.com/form/global/scripts/rsv.js"></script> <script type="text/javascript"> 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)" Did you get yours to work? Terry RE: Form Validation not working - alrioart - Jul 3rd, 2009 I figured out the problem. It's the rsv.js script itself that is packaged in the current download. I was determined to fix this because Ben's sample forms worked perfectly. I downloaded *his* rsv.js file and now it works! The package with the bad file (? maybe) is 20090627 Terry RE: Form Validation not working - Ben - Jul 4th, 2009 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. I documented what you'll need to do in this tutorial: http://docs.formtools.org/tutorials/js_validation/?page=finished_product Namely, these three lines: Code: // these lines are required if you're using the rsv.js file that's bundled with Form Tools. 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 RE: Form Validation not working - alrioart - Jul 4th, 2009 FYI - I did have those those lines in my page when I was having the problems. Downloading the new rsv.js from your site is what fixed my issue. T RE: Form Validation not working - jlkane - Sep 29th, 2009 (Jul 4th, 2009, 11:02 AM)Ben Wrote: Hey Terry, 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. Jim RE: Form Validation not working - Ben - Oct 3rd, 2009 Hey Jim, Will do. Thanks for the post! I've jotted this down on today's TODO list. If I haven't posted a fix by tomorrow, post a reminder. :-) - Ben RE: Form Validation not working - Ben - Oct 3rd, 2009 Hey all, 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. I'll include a fix for this in tonight's build. - Ben RE: Form Validation not working - alrioart - Oct 3rd, 2009 Thanks Ben. Terry RE: Form Validation not working - jlkane - Oct 4th, 2009 I wonder if Terry tested the new version of rsv.js. I downloaded and tested it ...and (for me) it still doesn't work. :-( Sorry Ben, Jim |