Copy link to clipboard
Copied
I have a dropdown menu, that when an item is selected a description appears in a text box from the selection in the dropdown list. This is the script I already have, but it only shows for the first item in the dropdown list. I need help getting the text field to show from every selection in my dropdown list.
var v = event.value;
var targetValue = "";
if (v == "Appliance Repair")'
{
targetValue = "Text";
}
else if (v == "Carpet Repair")
{
targetValue = "Text2";
}
this.getField("Description").value = targetValue;
You had a bunch of issues with conflicting scripts in multiple fields. I fixed it for you in the attached file:
Test Document_edited.pdf - Google Drive
You should study the code and where it's placed, for future reference.
Copy link to clipboard
Copied
Where did you place this code?
Copy link to clipboard
Copied
I have this code under calculate section, custom script.
Copy link to clipboard
Copied
It should be used as the custom validation script of the drop-down field.
Copy link to clipboard
Copied
Ok, I've placed it there now and still only one item in the dropdown list populates a description in my text field. When I select to another selection the text field does not populate.
Copy link to clipboard
Copied
Go to the Properties of the drop-down field, Options tab, and tick the "Commit selected value immediately" box.
Copy link to clipboard
Copied
Yes, that is already selected. I do not understand how it will complete the script off of the first selection, but after that nothing appears.
Copy link to clipboard
Copied
Maybe you didn't enter the exact same text into the script as appears in the field's options list... Even if a single character is not exactly the same (including lower/upper-case, spaces, etc.), it won't work.
Copy link to clipboard
Copied
Everything matches, is it possible for me to upload a link to document in drop box and you take a look?
Copy link to clipboard
Copied
Yes. Use Dropbox, Google Drive, Adobe Cloud, etc., and post the link here.
Copy link to clipboard
Copied
Here is the link. https://www.dropbox.com/s/2kr9mdyn48mogw3/Test%20Document.pdf?dl=0
Copy link to clipboard
Copied
I don't see where you placed the script...
Copy link to clipboard
Copied
Check the facility request dropdown and it is under the calculated tab. you may have to move the dropdown boxes from over top of each other so that you can essentially check the dropdown properties.
Copy link to clipboard
Copied
You had a bunch of issues with conflicting scripts in multiple fields. I fixed it for you in the attached file:
Test Document_edited.pdf - Google Drive
You should study the code and where it's placed, for future reference.
Copy link to clipboard
Copied
Appreciate it, I had multiple script because of the other actions I needed done for the document.
Copy link to clipboard
Copied
Just wanted to say, for some reason when I copy the existing code into another pdf form that is an exact replica, it still has issues after the first selection.
Copy link to clipboard
Copied
Make sure you've removed all the calculation scripts from all of the fields involved.
Copy link to clipboard
Copied
Yes, I did and then I just went and placed the script you implemented in the designated spots and the script for the populated text doesn't work pass the first selection. Now the script for the drop down to show or hide the other dropdown works from document to document.
Copy link to clipboard
Copied
Again, you'll need to share the file.
Copy link to clipboard
Copied
I looked at it closely and figured out what I had wrong. Thank you again for all the help.
Copy link to clipboard
Copied
I have one last question, is it possible where I have the date field to populate a calendar so that it can be selected to fill in rather then someone typing?
Copy link to clipboard
Copied
Acrobat/Reader DC has an automatic calendar popup for any field with Date formatting.
Copy link to clipboard
Copied
Adobe acrobat XI pro doesn’t show it. So are you saying a person must own a subscription to adobe pro DC?
Copy link to clipboard
Copied
No, all they need is the Free Acrobat Reader.
But if you want to add an explicit calendar popup to your form, there is a free one here:
Free Sample PDF Files with scripts
However, this is from back in the pre-DC days. Now that there is an automatic calendar popup, you'll need to add code to test the user's version before displaying it to prevent a conflict.