Click to See Complete Forum and Search --> : using [ ] in field names


cyborg
07-09-2003, 11:13 AM
hey. I'm scripting in php, and it saves me time when using functions to name my fields using array names .. ex would be field[0], field[1], etc...

for some reason, javascript doesn't support the field names, and when I want to manipulate them (to check lengths, etc..)... ex document.formName.field[1].value.length ... it gives me an error...

does anyone know how I could fix the problem?

requestcode
07-09-2003, 12:23 PM
You could reference them throught the forms array. For instance to reference the first form element you would do this:
document.form_name.elements[0].value.length