How to use text box with multiple values populate another text box to have different multiple values
Copy link to clipboard
Copied
I need help! 🙂 I'm using Adobe Acrobat Pro DC and am looking for javascript. I have a text field called "FamilySize" adding up 2 other text boxes (NumAdults and NumChildren and their sum is the household total which is represented in the "FamilySize" textbox). I have another text box called "PovGuideline" that I would like to populate with a specific dollar amount dependent on the number being reported in the "FamilySize" text box. For example, if "FamilySize" reports a value of 2, then I would want "PovGuideline" to report a value of $17,240. I would like the "PovGuideline" text box to be able to report back a different dollar amount value for up to 12 different amounts. I hope this makes sense... 🙂 Thank you in advance for any help anyone is able to provide.
Copy link to clipboard
Copied
You can do this in a variety of ways using javascript.
Personally I am not very knowledgeable in javascript but I use a lot in my PDFs very simple custom calculating scripts; declare variables and then employ conditions to be met using IF and ELSE IF statements.
For example,with my very novice knowledge in javascript this is how I would do it:
/* use this as a custom calculating script for the POVGuideline text fild; declare your variable*/
var f = this.getField("FamilySize").valueAsString;
//then your conditional statements
if (f !=="") {
if (a=="2") event.value = "$17,240";
else if (a=="3") event.value = "$18,240";
esle if (a=="4") event.value = "$19,240";
else if (f=="") event.value="";
}
Copy link to clipboard
Copied
Just a small side-note: It's better to apply the values as pure numbers and then add the formatting (currency symbol, thousands separator, etc.) using the Format tab. If you do it like that you won't be able to use them in further calculations later on, for example if you wanted to sum them all up to get a grand total.

