Hey everyone,
I am currently making a form in which I need to be able to access multiple form objects of the same name.
I was under the impression that if you had 2 form elements with the same name an array would be automatically created so you could then access either of the elements like so:
Could be accessed with this:
Unfortunatly, my code does not seem to be working. The firefox javascript console says: "document.form1.samename has no properties."
Anybody have any ideas?
I am currently making a form in which I need to be able to access multiple form objects of the same name.
I was under the impression that if you had 2 form elements with the same name an array would be automatically created so you could then access either of the elements like so:
Code:
<form name="form1" method="post">
<input type="text" value="test" name="samename">
<input type="text" value="test" name="samename">
</form>
Code:
<script language="javascript">
//to access the first one
document.form1.samename[0].disabled=true;
//to access the second one
alert(document.form1.samename[1].value);
</script>
Anybody have any ideas?