Copy link to clipboard
Copied
I have created a from in Acrobat Pro Dc that is a report. I have a dropdown list called "speaking and listening" that I want to populate a text field field called "comment". I want the form to be able to make a selection from the list then add a sentence to the text field. The possible selections are:
Outstanding
High
Sound
Basic
Limited
I want there to be a different sentence for each selection. If have tried a few scripts but haven't been able to get any to work correctly.
I am hoping someone might be able to help.
Thank you
See this great (and free) sample, data and JavaScript are all in the dropdown :
http://abracadabrapdf.net/parking/AcroUsers/Populate-text-field-from-dropdown.pdf
Copy link to clipboard
Copied
You say you want to "add a sentence to the text field". Do you mean that you want to keep whatever value it already has and the new sentence to it, or do you actually mean that you want to set the field's value to be that sentence?
Also, should the text field be editable by the user, or should its value only be determined by the value of the drop-down field?
Copy link to clipboard
Copied
I mean I want the selection to stay in the drop down then a seperate sentence to appear in the text field.
E.g if sound is selected in the drop down the the text field would show "indicator for sound knowledge". Then if you selected high the text field would show "indicator for high knowledge" etc
the field would be blank so the sentence would become the fields value, I think. I want the text field to be editable too in case minor changes need to be made.
Thank you for replying
Copy link to clipboard
Copied
OK. As the custom validation script of the drop-down you can use something like this, then:
if (event.value=="Sound") this.getField("Text1").value = "indicator for high knowledge"; // etc.
Copy link to clipboard
Copied
Thanks for reply but the code did not work for me. I was unable to get it to put any text into the text field.
Copy link to clipboard
Copied
You're probably doing something wrong... Can you share the file?
Copy link to clipboard
Copied
report template.pdf - Google Drive
Here is the template I am trying to work with. I want the dropdown in the achievement column to populate the text box underneath.
Thanks for the help
Copy link to clipboard
Copied
Hello! I used to create forms in Livecycle Designer 7.... Don't laugh! It actually worked pretty decently. Anyway, I no longer have that program and Acrobat cannot edit the PDFs created with Livecycle so I'm creating forms all over again as a form needs to be updated. My question tacks onto the end of the one you replied to.... but I have an additional question. I used the string of code you gave:
if (event.value=="Sound") this.getField("Text1").value = "indicator for high knowledge"; // etc.
and altered it to match my field's names. It (obviously) works. My question is... is there a character that can be used to send text to a 2nd/3rd/4/th line?
When I select "Wilmington" in my combo box, I want the text box to be filled like this:
business name
address 1
city, state, zip
phone number
fax number
If I simply type all the info in where you have "indicator for high knowledge" then the text field is filled with the info all on one line like so:
business name address 1 city, state, zip phone number fax number
Thoughts??
Copy link to clipboard
Copied
Use "\n" to add a line-break in the middle of a string, like this:
"business name\naddress 1\ncity, state, zip\nphone number\nfax number"
Of course, you have to set the field as being Multiline for it to display correctly.
Copy link to clipboard
Copied
Perfect! Thank you!
Copy link to clipboard
Copied
See this great (and free) sample, data and JavaScript are all in the dropdown :
http://abracadabrapdf.net/parking/AcroUsers/Populate-text-field-from-dropdown.pdf
Copy link to clipboard
Copied
when i try this code It just copies the choice from the dropdown into the text field. E.g if I select sound it will put sound into the text field. How do i edit the sentences?
Thank you
Copy link to clipboard
Copied
I worked it out. Thank you so much for code. Is there anyway for there to be multiple lines of text in the one textfield from several different dropdown selections?
Thank you