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.
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.