[thelist] Forms and returning true from multiple validation functions
Ben Gustafson
ben_gustafson at lionbridge.com
Wed Feb 14 09:50:03 CST 2001
I have a form which uses three separate functions to validate different
types of form elements in it. I want to restrict the form from being
submitted only to when true is returned from all three validation functions.
I have tried using
onSubmit="return (isInt() && countBoxes() && numToReg())"
within the form tag, and creating a "nesting" function
function checkWSForm() {
return (isInt() && numToReg() && countBoxes())
}
with
onSubmit="return checkWSForm()"
in the form tag as way to consolidate them. The first example submits the
form if true is returned from the first function in the return list (in this
case, isInt()), and does so no matter which function is first. The second
example fails completely, and always allows the form to be submitted. Does
anyone have ideas on how to keep the form from being submitted if false is
returned from any of the functions (without piling them into one function as
a bunch of unrelated if statements)?
Thanks,
--Ben Gustafson
www.lionbridge.com
More information about the thelist
mailing list