Copy link to clipboard
Copied
I am needing a javascript to have text populate in a seperate text filed when a selection is made from a dropdown box. I am new and not even sure how to imput the javascript once I have it. Please help! This is for a Fillable PDF I am trying to create. In the document I am trying to have the selection from dropdown box labeled "Class" on page 1, to auto populate the text from drop donw box "Allocation Factor I" on page 2, but in a text filed. Example. you select "Rehabilitation Representative" from page one, you get "The Rehabilitation Representative classification represents an entry-level scope of couseling skills and limited decision-making authority. Work is closely monitored." in a text box instead of what I currently have as another dropdown box. Thanky ou in advance for your help!
Copy link to clipboard
Copied
Do you want the user to be able to edit this text, or should be determined solely based on the selection in the drop-down?
Copy link to clipboard
Copied
unable to edit. Thank you
Copy link to clipboard
Copied
Change the second field to a text field, and use the following code as its custom Calculation script:
var vClass = this.getField("Class").valueAsString;
if (vClass=="Select one") event.value = "";
else if (vClass=="Rehabilitation Representative") event.value = "The Rehabilitation Representative classification represents an entry-level scope of couseling skills and limited decision-making authority. Work is closely monitored.";
else if (vClass=="Rehabilitation Counselor, Senior") event.value = "Text for: Rehabilitation Counselor, Senior";
else if (vClass=="Rehabilitation Counselor, Career") event.value = "Text for: Rehabilitation Counselor, Career";
Copy link to clipboard
Copied
This is super helpful, thanks for posting this. I am a n00b as well and am trying to do something similar. I have a dropdown box with a list of items. I want a user to select an item and have an output to a standard text box. Example" user selects "item 1" from dropdown box1 and a representative number, say "10", is output in textbox 1. I'm banging my head against the wall. Any guidance would be most appreciated. Thanks in advance!
Copy link to clipboard
Copied
I tried this coding in my file, but instead of "Rehabilitation Representative", I changed it to what I'm using to "Wedding Reception". It didn't work. I'm not understanding the basic function... do I put the coding in the text box, or the dropdown box? Do I need to select Wedding Reception in the dropdown box when in Prepare A Form setting, and if so, how do I assign Wedding Reption to that specific code to appear in a separate text box? I have five different items in the dropdown menu, and don't understand javascript at all to know how to assign the five items to have uniquely different descriptions in the one text box. Can anyone help?
Copy link to clipboard
Copied
The script posted above should go to text field as 'Custom calculation script'.
If you look at the script you will see where you need to put description, for example in this line:
else if (vClass=="Rehabilitation Counselor, Senior") event.value = "Text for: Rehabilitation Counselor, Senior";
else if (vClass=="Rehabilitation Counselor, Senior")//here you compare selection from dropdown field if you selected "Rehabilitation Counselor, Senior" in dropdown field, text field will show "Text for: Rehabilitation Counselor, Senior"
Copy link to clipboard
Copied