Show the List of a Drop Down List
Did you know that the list portion of a drop down list field can be displayed programmatically? You can set focus to the field and force its drop list to be displayed all in a single API call:
xfa.host.openList(@object)
xfa.host.openList(@string) -- deprecated since XFA 2.6
where @object is a reference to the drop down list field and @string is the SOM expression of the drop down list field.
xfa.host.openList(myDropDownList); // set focus/show the drop list
The second form of the API has been deprecated since XFA 2.6 which means that since Designer 8.1, it is preferred to use the first form which takes a reference to the field rather than its SOM expression.
If you’re using Designer 8.0 or earlier, you can get the SOM expression of any field by using its somExpression property:
xfa.host.openList(ddlInDesigner71.somExpression)
This works in both JavaScript and FormCalc with the same syntax.
Now if only there was a way to programmatically show the drop calendar of a date/time field…
Posted by Stefan Cameron on May 31st, 2010
Filed under Scripting,Tips,Tutorials,XFA