I am trying to set a multi-value field in Javascript, but the field name is dynamic — that is, the name is determined by a number…
The form is has the fields defined on it, however, are shown/hidden/populated through Javascript, so when the form is reopened, we have to populated the fields again…
Here is the code that I am working on:
function editQuery(myForm) {
// Get the row filters that were used in the last query...
for (f = 1; f < 16; f++) {
filter = eval("myForm.FilterList_" + f)
if (filter.selectedIndex > 0) {
var savedFilterMethodValue = eval("myForm.FilterMethod_" + f + ".value");
var savedFitlerValues = eval("myForm.FilterChoices_" + f + ".value");
displayNextFilter(f); // display it
updateFilters(this); // update the filters
// take the saved methods and values and then update the selections
}
}
}
The problem is, I can get the value of the field:
var savedFilterMethodValue = eval(“myForm.FilterMethod_” + f + “.value”);
But how do I populate it? This won’t work (can’t put the eval statement on the left), but guessing something like this:
eval(“myForm.FilterMethod_” + f + “.value”) = savedFilterMethodValue;
Or is there an easier way?
Thanks!
Dan