My job depends on me getting this right. Based on the DDL selection (change) certain part of the function will run. I also have a numeric filed (exit) that will activate the function, which will reference the DDL selection and spit out an answer for a text field...Thanks for your help!!!
Here is my function and code for one of the DDL selection:
else if ( xfa.event.newText == "Research Scientist I-F" )
TextField16.rawValue = "NOT ELIGIBLE";
var total = ( NumericField9.rawValue )
if ( total > 0.89 )
TextField13.rawValue = "Faculty Benefits";
if ( total < 0.90 )
TextField13.rawValue = "Manager Benefits";
if ( total < 0.50 )
TextField13.rawValue = "PTO/ESL";
if ( total < 0.25 )
TextField13.rawValue = "No Benefits";
1) What should I reference the DDL selection in code is it xfa.event.newText or DropDownList5.rawValue niether work right now?
2)When I run the code in the DDL5 it works only if I go back and select Research Scientist I-F again, this is based on the (change)event.
3)My "Script Object" is called Automation and I am referencing my function in the DDL and Numeric Field as: Automation.fxnPrepopulateFields();
I woudl suggest that you use the exit event instead of the change event. The xfa.event.newText will contain the changed value of the dropdown. I am not sure that it will still be there when you run your function. Try using am app.alert(xfa.event.newText) to see what you are getting. It may be just the selected index and not the actual string. To get the string use DDListName.rawValue or selectedValue depending on which value you want.
Paul, I am not understanding your advice. Please advise. when referencing the dropdown selection in the function should I use dropdownlist# or xfa.event.newText? Is the xfa.event.newText only used when you are using a "change" event for a dropdownlist?
When you respond could you give me code instead of an explanation?-Thanks-Allen
The xfa.event.newText will have the value of the selected dropdown will focus is still on the dropdown. The rawValue property will not be populated until you leave the dropdown. So depending on when you want the value will determine which property to use. Note that the xfa.event.newText will return the value and not the text of the dropdown (assuming you have both set).
The xfa.event.newText will give you what was entered into a field while it still has focus. In a DD List the selected values are returned. In a textField you would get the chars that are typed into the field. Once focus leaves the field the event.newText is cleared and it is ready for the next field to populate it.