Expand my Community achievements bar.

Dropdown list populates Textfield based on Numeric field data!

Avatar

Level 1
How do I get the exit data in NumericField9 to auto-populate the text for TextField13 based on the DropDownList5 selection?

The ideal flow would be; (1) DropDownList5 selection (2) NumericField9 data entered (3) Textfield13 auto-populated text.



My current code below almost gets me there. After the DropDownlist is selected it populates TextField13 with "no benefits". I then have to re-select the DropDownList selection for the proper TextField13 autopopulation after NumericField9 has been filled in.



1. Drop Down list 5

else if ( xfa.event.newText == "Research Scientist I-F" )

{

DropDownList8.clearItems();

DropDownList8.addItem("000001");

TextField16.rawValue = "NOT ELIGIBLE";

TextField13.rawValue = "Manager Benefits";

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";

}

}



2. Number field 9

form1.#subform[6].NumericField9::exit - (JavaScript, client)

if ( this.rawValue > 1 ) this.rawValue /= 100;



3. Text Field 13

form1.#subform[6].TextField13::change - (JavaScript, client)
4 Replies

Avatar

Former Community Member
Use the Calculate event on Textfield 9 so that when it changes it will do its calc and update field13.

Avatar

Level 1
Ok, I will try this. Please advise on the code. What code should I put in the "numericField9" under the Calc event to reference the DropDownList5 selection, so that the proper text field can be displayed.

OR

Should I post the text field reference in the numericfield9 so that it can identify, which dropdown5 selection has occured to autopopulate the textfield13. Please give an example of code to use.

Avatar

Former Community Member
To reference the DDlist5 you should be able to use DropDownList5.rawValue.



The code shoudl be something like this:



Textfield13.rawValue = DDList5.rawValue + TextField9.rawValue

Avatar

Level 1
I figured it out on my own....All I had to do was identify the "exit" response on each possible DropDownList selection for auto populating the text field. Code as follows:



form1.#subform[6].NumericField9::exit - (JavaScript, client)

if ( this.rawValue > 1 ) this.rawValue /= 100;

else if ( DropDownList5.rawValue == "Research Scientist I-F" );

var total = ( NumericField9.rawValue );



{

if ( total > 0.89 )

TextField13.rawValue = "Manager 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";

}



else if ( DropDownList5.rawValue == "Research Scientist II-F");

var total = (NumericField9.rawValue );



and so on.....it goes like the one above....Good Luck with this and I hope it helps someone else.---Allen