Form element array problem. Please Help!!!

wxdqz

New Member
Hi all,

I am having a problem with accessing values in a form element array.

Basically, for example, I have 20 hidden fields and I want to swap 2 values of 2 selected fields. When the swap function is executed I assign the value of one of the fields to a temporary variable, eg.

tempnum = eval("document.formname.elementname[" + swapnum1 + "].value");

But when I run the code, I get an error and in the error message it says:

'document.formname.elementname.1' is not an object

Notice that instead of being document.formname.elementname[1].value it is actually changed to document.formname.elementname.1, but I don't know why. Can anyone explain to me where I am going wrong?

Thanks in advance,
Chris
 
Back
Top