Topic
1 reply Latest Post - ‏2011-06-27T12:45:34Z by miro_novotny
miro_novotny
miro_novotny
3 Posts
ACCEPTED ANSWER

Pinned topic How to set "Optional Descriptive text" to ChoiceList items dynamically

‏2011-06-27T08:11:47Z |
Hi all,

I use eForm Designer Version 5.0.3.3, P8 CE 5.0, WAS 7.0.
The following example creates a new choice list named ColorList with three values: orange, purple, and green.

form.createChoiceList("ColorList", new Array("orange", "purple", "green");

How can I add to choices the optional descriptive text ?
I need to show the "Optional Descriptive text" to user and the "Choice value" send to futher processing.

Thanks
Miro
Updated on 2011-06-27T12:45:34Z at 2011-06-27T12:45:34Z by miro_novotny
  • miro_novotny
    miro_novotny
    3 Posts
    ACCEPTED ANSWER

    Re: How to set "Optional Descriptive text" to ChoiceList items dynamically

    ‏2011-06-27T12:45:34Z  in response to miro_novotny
    I already found the solution, it's easy:

    Every item should contain 2 values (description,value) separated by 2 pipes, "Desc1||Value1".
    So the sample for choicelist with 3 items is as folows:
    var varVal = new Value("Orange item||orange;Purple item||purple;Green item||green;");
    fillChoiceList(varVal, "Fruits");
    function fillChoiceList(values, chlName)
    {
    var myChoiceList = form.getChoiceList(chlName);
    if( myChoiceList==null) throw "ChoiceList" + chlName + " not exist.";
    var choiceArray = values.asString().toString().split(";");
    myChoiceList.setChoices(choiceArray);
    }
    MiroN