06-22-2012 09:38 AM
Is it possible to set the option list for a select via javascript? I see that you can select an option with
serviceForm.<form name>.<field name>.setSelection(["option1");
but I'm curious if you can also populate the list dynamically with the javascript api
06-25-2012 08:18 PM
There are helper functions that are defined within the isfcode libraries, but I don't think it's usually deployed at customers.
There are not any "core" ISF functions to use for this (serviceForm....). What you have to use instead is just raw javascript.
A few samples:
//# elements
document.getElementById("Dictionary.FieldName").options.length;
//value of index i
document.getElementById("Dictionary.FieldName").options[i].value;
//use this in a loop and set the values of the drop down.
document.getElementById("Dictionary.FieldName").options[i] = new Option(newstrValue,newValue,false,false);
Usually the dropdown is either known in advance or set with a data retrieval rule. You should re-examine the use case and see if you can avoid using the javascript method.
06-26-2012 03:47 AM
I see - that makes sense - thanks!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide