trouble calling a function to validate form input

Giganews Newsgroups
Subject: trouble calling a function to validate form input
Posted by:  bbxrider (bbxride…@comcast.net)
Date: Wed, 30 Jul 2003

i'm trying to pass a form object to a function to validate the forms user
input
when i try to access a forms properties-like .elements[x] there is no
response from the function and no error msg, i get a screen flash
and
if i try to preset an element property before calling the function like:
this.firstName.optional=true;
the code after that doesn't get executed
going bananas, please help

to successfully call the function:
<input type="button" value="Submit Volunteer Information"
onclick="
alert('this message at start of onclick');
verify(this);">

the called function:
function verify(f) {
alert('now entering verify function');
var msg1 = "the current message is = " ;
var e = f.elements[0];
msg1 += e.type;
alert(msg1);
return false;
}
so...... i get the first alert, then nothing????

and while on the subject this code does not even get as far as the 2nd
alert:
<input type="button" value="Submit Volunteer Information"
onclick="
alert('this message at start of onclick');
this.firstName.optional=true;
alert('this message after optional assignment');
verify(this);">

Replies