Copy link to clipboard
Copied
Hi All,
I'm trying to set up a drop down field appropriately, however I can't find a good solution.
What I need is:
- a drop down list with 1, 2 or 3 values from different text boxes, but with possibility to fill in drop down field manually.
E.g.
Text Box 1 - "Name 1"
Text Box 2 - "Name 2"
In the drop down list, I need to be able to choose either Name 1 or Name 2, and the ability to enter manually in this field another value if it would be Name 3 not entered in the other Text Boxes in the PDF file.
Do you have any idea?
Thank you in advance.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
For manually entry in dropdown field properties, under 'options' tab, check 'Allow user to enter custom text'.
Let's say your field names are "TextBox.1", "TextBox.2", "TextBox.3", you can use this script as 'Custom calculation script' of dropdown field:
if(/^TextBox/.test(event.source.name)){
var textData = this.getField("TextBox").getArray().map(function(a){return a.valueAsString;});
var cList = textData.filter(function(a){return (a.length > 0);});
event.target.setItems(cList);}
Copy link to clipboard
Copied
Unfortunatelly it does not work. No drop down list appears when I enter the name of the appropriate field in the "TextBox". And how to add properly TextBox.2 and TextBox.3?
Copy link to clipboard
Copied
Here is a working example:
https://drive.google.com/file/d/1DbxIYTR4WP81VH6yD_vc4MULU58RvhG4/view?usp=share_link
Copy link to clipboard
Copied
Yes, that's it!
Thank you!
Copy link to clipboard
Copied
One more thing, maybe you will know.
There are: TextBox.1, TextBox.2
There is Dropdown1 - I can choose between TextBox.1 and TextBox.2 or put value manually - as resolved earlier.
Now I need Dropdown2, where I can choose between TextBox.1, TextBox.2 and value put manually in Dropdown1. I have resolved this by populate TextBox.1, TextBox.2 and Dropdown1 to new textfields (eg. Name.1, Name.2, Name.3) by: event.value = this.getField("Name.1...3").value; and adding to Dropdown2 your script with "Name" in the right places. Name.1 and Name.2 works fine, but if I put value manually in Dropdown1, it does not update immediately in the Dropdown2 list in Name.3, even if filed Name.3 is updated.
Eg.
TextBox.1 = Value 1
TextBox.2 = Value 2
Dropdown1 = Value 3 - entered manually
Dropdown2 - I can choose Value 1, Value 2 and Value 1 (as the third choice)
Now, if I change Value 3 to Value 4 in Dropdown1 - manually - I am able to choose Value 1, Value 2 and Value 3 (previous value of Dropdown1) in Dropdown2.
If I chenge Value 4 to Value 5 I will be able to choose Value 4 in Dropdown2 - previous value of Dropdown1, again.
Maybe there is an easier way, or do you know why is this happening?
Copy link to clipboard
Copied
HI link doesn't work..
Copy link to clipboard
Copied
Can you describe what do you need help with?
Copy link to clipboard
Copied
I'm trying to download file from https://drive.google.com/file/d/1DbxIYTR4WP81VH6yD_vc4MULU58RvhG4/view?usp=share_link .
Not sure I'm in right area, but I want to populate a dropdown field from data entered into other fields i.e. multiple text fields or a single log text field.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more