Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to populate drop down list based on text boxes and make it editable field?

Community Beginner ,
Feb 17, 2023 Feb 17, 2023

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. 

TOPICS
How to , JavaScript , PDF forms
4.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Feb 18, 2023 Feb 18, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 17, 2023 Feb 17, 2023

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);}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 18, 2023 Feb 18, 2023

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? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 18, 2023 Feb 18, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 18, 2023 Feb 18, 2023

Yes, that's it!

Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 18, 2023 Feb 18, 2023

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?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 04, 2024 Feb 04, 2024

HI link doesn't work..

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 04, 2024 Feb 04, 2024

Can you describe what do you need help with?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 04, 2024 Feb 04, 2024
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines