Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

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: -- 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.; // 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:

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
Both comments and pings are currently closed.

4 Responses to “Show the List of a Drop Down List”

  1. rohit kumar behera on June 5th, 2010

    Hi Stefan

    I am trying to find out a way in which my livecycle designer form will be able to create a new pages based on a certain field value which is a part of Say I have to generate the payslip of 5 employee – My form should be able to provide me with 5 different pages for each employee. at runtime. It will have some prepopulated data fields (read Only) like employee Id or Employee designation or department and some additional fields which needs to be filled by the user.

    In short If I have three employees say emp A, B & C then I should have 3 pages one each for A, B &C with their respective data prepopulated in the readOnly fields.The number of employees will be a variable which will be binded in the context and will be a part of the data model of the form.

    I would like to know if such a functionality is possible to be achieved in the designer.

    Thanks and Regards.


  2. Stefan Cameron on June 16th, 2010

    @rohit kumar behera,

    This is definitely possible. The way you describe it makes it sound like you have a number in some data node that indicates the number of employees rather than having a repeating data set (like a repeating <employee>). In that case, you’ll have to do most of the work yourself by adding script to a field which you bind to this data node. In the field’s Initialize event, you can get the field’s value and use the Instance Manager of a repeatable subform to create instances of this subform at runtime. This subform would simply be designed to be the size of a page and contain the necessary fields to capture the pertaining employee information.

    Adding instances of a repeatable subform that is the size of a page will generate new pages in your form.

  3. Leon on September 23rd, 2010

    I am trying to populate a table in LiveCycle 8.2 with records from a sql table. I can get the list box to work but I can’t figure out how to get the table to list my records and grow with the number of records thats returned by the query of the sql table. Sometimes there will be one row, sometimes there could be 20-30 rows. I only need to display 2 columns in the table. The table contents would be based on a selected item from a dropdown list (I used one of your other examples to accomplish this! – thank you!)

    What is the script that I would use to do that?

    I appreciate your help with this.


  4. Stefan Cameron on October 1st, 2010


    Please see my tutorial on displaying all records from an ODBC connection.