Click to See Complete Forum and Search --> : Accessing form fields with brackets in name


simonbc
11-22-2002, 04:20 AM
I am trying to access a form field named "edbpriser[1]" with the following function:

function returnkode (edbpriser_kode) {
opener.document.kode.edbpriser[1].value = edbpriser_kode;
}

but I get this error:

"opener.document.kode.edbpriser1 is not an object."

Does anyone know what I'm doing wrong here?

Charles
11-22-2002, 05:45 AM
Your use of brackets in the field name is confusing the scripting engine. It thinks that you are trying to assign to the 'value' property of the object stored in the second element of the array 'opener.document.kode.edbpriser'. I'm afraid that you will need to rename your form controls.