validating form data via javaScript when stored in an array

From: Date: Mon, 09 Apr 2001 07:24:50 +0000
Subject: validating form data via javaScript when stored in an array
Groups: php.general 
Request: Send a blank email to php-general+get-47737@lists.php.net to get a copy of this message
G'day, I was wondering if anyone knows how to get the following to work: --snip from head-- <script language="JavaScript"> //--> function validateForm(theForm) { if ( theForm.input[name].value == "" ) { alert("You must type a value for NAME."); theForm.input[name].focus(); return false; } } <!-- </script> --/snip-- --snip from body--- <form name="form" method="post" action="whatever" onSubmit="return validateForm(this);"> <input type="text" name="input[name]"> <input type="text" name="input[address]"> <input type="submit" value="submit"> </form> --/snip-- Now the above doesn't work as I think javascript does not understand arrays? or I don't understand how javascript deals with arrays?? Any help/suggestions would be great, sorry if this post is a little off topic in the way of javascript but I would not be having this trouble if I weren't passing the form data to php via an array :-) Regards, Joseph.

« previous php.general (#47737) next »