Forum Moderators: open

Message Too Old, No Replies

how to access hidden field values in array

         

brnco

3:20 pm on Dec 4, 2007 (gmt 0)

10+ Year Member



Hi,

I have a script which should go throught the hidden field which is an array: hiddenField[].

I also have a cycle which goes through the lenghth of the array but I can't access the values.

Can you please help me with that?

var hidds = document.form1.hiddenField[a1].value;

gergoe

4:28 pm on Dec 4, 2007 (gmt 0)

10+ Year Member



Use document.form.elements[index], where index is the number of the input control on the form. You can make a loop which goes through the form's elements, and within this loop you can evaluate the name field. Something like this:

for (var idx=0; idx<document.form1.elements.length; idx++) {
if (document.form1.elements[idx].name == 'hiddenField[]') {
//
// Do something with document.form1.elements[idx]
}
}

Dabrowski

5:03 pm on Dec 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a script which should go throught the hidden field which is an array: hiddenField[].

Please elaborate? You can't have a hidden <input> field that is an array.