Morten Winkler Jørgensen wrote:
>
> You will have to declare
> <SCRIPT LANGUAGE="javascript 1.2">
>
> myArray = new Array();
>
> myArray[0] = "a string";
> myArray[1] = 11;
> myArray[2] = new Array();
> </SCRIPT>
>
> since JavaScript 1.2 has arrays implemented.
>
Thanks for that, but my problem being that I have just collected all my
form data in an array:
input[keyname]
how do I now build the equivelent js array to validate the data?
I tried the following still does not work:
--snip from head--
<script language="JavaScript1.2">
//-->
input = new Array();
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--
How do I force all the data into the javascript array, while still
setting the array to input[keyname]?
Any help appreciated,
Regards
Joseph
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]