Copy link to clipboard
Copied
I have a multiline text box (List of possible names) in form #1 that i am trying to use to populate a dropdown box in form #2 where the user will select a name from that list for a specific response.
I tried FDF to export out from form #1 and import into form #2 with no luck. "Textbox" to "Dropdown" via FDF does not push the contents of the textbox into the dropdown. I have tried to populate a 'helper' dropdown in form number 1 and then use the FDF export/import process (so i am moving data from a dropdown in form #1 to a dropdown in form #2) but this also was unsuccessful.
i am hopeful the community may have a suggestion.
Please let me know if additional info is needed.
thank you all kindly in advance.
Copy link to clipboard
Copied
Not directly, no. However, what you can do is populate another (hidden) text field with the names from the original field, and then use a script to populate the items in the drop-down with those names.
The latter code would be something like this:
var names = this.getField("Names").valueAsString;
this.getField("NamesList").setItems(names.split("\r"));
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@try67 Hello Again,
Could use your advice and instruction: without observable reason the code snippet you shared is populating my dropdown list of names on a single line. What modifications to the code should i make to locate each name on a new line within the dropdown?
A sample list of names might include:
Robert Abrams
Sydney Carstle
Emma Vognier
Juliette Washington
thank you again for the assistance.
Copy link to clipboard
Copied
Post your exact code, please.
Copy link to clipboard
Copied
Good Morning and thanks for the reply,
my exact code is:
var names = this.getField("GC_Team").valueAsString;
this.getField("Attention:").setItems(names.split("\r"));
Field name "GC_Team" is populated by my FDF file, output from a separate PDF form.
Field name "Attention:" is the dropdown box that includes the above javascript. The javascript is triggered by an "On Focus" mouse action associated with the "Attention:" field.
Thank you.
Copy link to clipboard
Copied
This is not a good setup. You should use the Validation script of the text field to populate the drop-down.
Also, you need to examine the value of the text field after importing it. Maybe it doesn't use the regular line breaks that are used when you manually enter the text ("\r"), but something like "\n" or even "\r\n".
To do that run this code from the Console:
this.getField("GC_Team").valueAsString.toSource();
Copy link to clipboard
Copied
I just confirmed via the console that field name "GC_Team" is a single line of first and last names, without line breaks. My challenge is to re-format these such that the drop down offers names on separate lines.
Can the prior snippet of code be used verbatim as a validation script of the text field "GC_Team"?
Copy link to clipboard
Copied
omigosh - firstly, my humblest apologies...
textbox "GC_Team" merely needed to be formatted to include "Multiline". the javascript, as previously organized is working. That due diligence was an error on my part.
my sincere thanks for your help tho thus far. Immeasurable.
Copy link to clipboard
Copied
I am highly motivated to learn more how to re-arrange my scripting per your suggestion: to use a Validation Script at the Textbox "GC_Team".. how would you instruct to do this (per my prior query)?
Thank you.
Copy link to clipboard
Copied
Just change this line:
var names = this.getField("GC_Team").valueAsString;
To this:
var names = event.value;
Find more inspiration, events, and resources on the new Adobe Community
Explore Now