Skip to main content
Participating Frequently
February 17, 2023
Answered

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

  • February 17, 2023
  • 1 reply
  • 4474 views

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. 

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
February 18, 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);}
Kamil5EF8Author
Participating Frequently
February 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? 

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
February 18, 2023