Copy link to clipboard
Copied
I am attempting to create a document where the person can select 1 or more options in the ListBox feature (or drop down menu if easier?) and this would autofill different text fields based on the selection – each selection would have a corresponding phrase that would autofill a in a text field. Then, each text field can only be used once, so once the first text field has a phrase in it, the next phrase (corresponding to listbox selection) would auto-insert into the next text field, etc.
I had a similar question to this regarding check boxes, so will use the same examples here but instead of each check box specific to each item, it would be a list box (or drop down menu) that would have all possible selections (ex: blood work, xrays, follow up appointment, etc.) in the one listbox/drop down menu and each selection inside of the box would autofill a specific phrase. If this is too complex or complicated, please let me know I’m more than happy to stick with check boxes. Also, here is a link to me other question just for reference.
Copy link to clipboard
Copied
The basic code to use is this (as the custom calculation script of the text field):
var sel = this.getField("Dropdown1").valueAsString;
if (sel=="ABC") event.value = "Some text for ABC";
else if (sel=="DEF") event.value = "Some other text for DEF"; // etc.
else event.value = "";
Copy link to clipboard
Copied
Thank you - would this work if all options are selected from 1 dropdown menu? or would this require multiple dropdown lists?
Copy link to clipboard
Copied
This code is based on selection in a single drop-down field, which is what I understood you asked for. If you want it to be dependent on the values of multiple fields, it would require a more complex code.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more