These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Check whether a particular value in a dropdown exists or not

adobechamp
Registered: Nov 26 2010
Posts: 1
Answered

Hi,
 
Iam using a dropdown in which values get populated during runtime from MDM.
 
i need to check a whether a particular value in that dropdown list exists or not.
 
If it exists then that value should be set as the default one.
 
How do i perform the check?(in javascript/FormCalc)
 
Waiting for reply...
 
Thanks

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Accepted Answer
Hi,

this is possible but the method depends on the method you populate the dropdown list.

An example:
You have a ddl and populate it on enter:event from an array stored in a variable named "MyDdlValues".
Therefore you use a for loop that pushes the values from the variable into the ddl.
In this loop you can add an if-expression that also checks the values and sets the matching one as default value.

  1. var arrayItems = eval(MyDdlValues.value);
  2. for (var i=0; i < arrayItems.length; i++)
  3. {
  4. this.addItem(arrayItems[i]);
  5. if (arrayItems[i] == "Lorem Ipsum")
  6. {
  7. this.setItemState(i,1);
  8. }
  9. }

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs