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

Designer logic and/or if then statements in forms

dburg
Registered: Jul 28 2007
Posts: 2

I am nw to Designer 7.0, I have created some simple forms already. I am trying to create a relationship between a drop-down list and a numeric field. The goal is to have the user select from the drop-down and have that action trigger an event that would in turn populate the numeric field with predetermined data.

My Product Information:
Acrobat Pro 7.0.0, Windows
sconforms
Expert
Registered: Jul 10 2007
Posts: 92
In order to populate the numeric field when the user makes a selection in the drop down list, you need to script the drop down list's Change event.

In XFA events, there's always an "xfa.event" object that's available to you which provides information about the event itself. In this case, you'll need the "xfa.event.newText" property which will contain the text for the item which was selected in the drop down list.

If your drop down list items have text and value data assigned to them, then you'll need to get the value of the data bound to the text data found in "xfa.event.newText". You can do this by using the "boundItem" method of the drop down list.

To recap so far, if the drop down list items only have text data, then all you need is

xfa.event.newText

If the items have text and value data, then you may need to use

this.boundItem(xfa.event.newText)

which will give you the data value associated with the selected text data.

From there, you can write a simple IF statement which compares the selected value with a criteria or simply set the numeric field's value to the selected value:

NumericField1.rawValue = this.boundItem(xfa.event.newText);

The above JavaScript statement -- placed in the drop down list's Change event -- will set the numeric field's value to the data value associated with the item that was selected in the drop down list.

(Note that you can edit object events by using the Script Editor palette available via the "Windows > Script Editor" menu.)

Stefan Cameron obtained his bachelor's degree with Honors in Computer Science at the University of Ottawa and is a Computer Scientist working on Adobe's LiveCycle server products, in particular on LiveCycle Designer ES for the past 5 years.

cvanmech
Registered: Jan 9 2009
Posts: 17
I am facing something similar.

I have 3 fields with a dropdown list namely a TAG, a Serial nr and component description, in fact the 3 fields have the same meaning, so they must be synchronised. When one is changed the 2 others must also change.



How can this be done?


Thanks