FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form Validation not working
#1
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.


Attached Files
.php   contact_webmaster.php (Size: 2.02 KB / Downloads: 7)
Reply
#2
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
Reply
#3
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
Reply
#4
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_v...ed_product

Namely, these three lines:
Code:
// 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
Reply
#5
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
Reply
#6
(Jul 4th, 2009, 11:02 AM)Ben Wrote: 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_v...ed_product

Namely, these three lines:
Code:
// 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.

Jim
Reply
#7
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
Reply
#8
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
Reply
#9
Thanks Ben.
Terry
Reply
#10
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)