I'm far from an expert at JavaScript as you're about to see.
I'm trying to pass an array of values to a series of html form fields.
the data in the array is in the variables dirLen[]
the form fields I'm trying to populate are named
dirLen1
dirLen2
dirLen3
etc...
I can pass individual array values to the individual form fields using:
form.field_name.value=arrayValue
so I know my array is good and that the above syntax works.
I just don't know the format to call the form field in the following for-loop.
// for-loop to populate form fields
for (var k=0;k<=23;k++)
{
form.dirLen[k].value=dirLen[k];
}
it's quite possible that you are referencing your form incorrectly. If you are just working with named fields (ie, no id's), easiest is to name your form.
you will also want to remove the dot between the form reference and the first square bracket, and also bear in mind that you are starting your loop off at 0 but your field names start at 1:
Bookmarks