Click to See Complete Forum and Search --> : how to use variables in order to adress form elements


dina
11-28-2003, 09:36 AM
Hi together,

I have to link drag&drop elements with form fields. When an object is droped, I want to adress the form field.

I have'nt found out how to build up the path to the element using variables.

Example:
alert(document.myForm.myField.vlaue);
Where myField is suffix + name off drag&drop element (<div>).

When I get the whole path in a variable, is there a possibility that it is not interpreted as string?

Thanks a lot
dina

gil davis
11-28-2003, 11:09 AM
alert(document.myForm[myField].vlaue);

dina
12-01-2003, 03:32 AM
Thanks, it works great!
It's so easy, I didn't think of brackets...