Preserved Topic: mr.maX script with multiple forms (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: New Jersey, USA |
posted 01-07-2002 03:49
I have been using mr.maX's form validation scripts which work very nicely of course, but I'm now trying to use them on a page with two forms and I'm not quite sure what I need to adjust to accomodate multiple forms on one page. One form just has a select box and submit button. The second form has three text fields, "date", "headline", and "content". Here's what I have tried, but isn't working: |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 01-07-2002 04:53
Hey butcher. Assuming you are using something like onSubmit=testandSubmit(this) (the this is the important part) to call the function you can simply call a different function depending on which form is being submitted. The this object sends a reference to the specific form so you don't have to do much rewriting. If you are naming your forms (<form name=form1...) you can put a simple if statement in your testandSubmit function. code: function testAndSubmit(form) {
|
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 01-07-2002 10:42
You can also write two different testAndSubmit() functions and call appropriate function on each form... |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 01-07-2002 20:59
Thanks guys! |