Forum Moderators: open
When having related checkboxes or fields and sending a form to a php script sometimes it's really usefull to make the names,
name="choice[1]" "choice[2]" "choice[3]" etc so it gets posted to the php as an array.
When dealing with these names in javascript before submission, with perhaps a js validation script it's a hassle to reference these variables.
If I already have a form Obj, say myForm and I go:
myForm.choice[1].value it fails as it reads choice as an array instead of variable name "choice[1]".
So I always have to go:
choice1 = document.getElementById('choice[1]');
choice1.value
I was just wondering if there was a way I could skip that step, and use something like...
myForm.{choice[1]}.value
Just so it doesn't read the [] as special caracters used for an array. Because if there are lots of [] that each need to be checked it could be a pain.
Thanks
adam