Skip to main content
Inspiring
February 21, 2020
Answered

Auto-populate list based on text fields with user input

  • February 21, 2020
  • 1 reply
  • 1109 views

Hi:

I am trying to to get a list to auto populate based on the users input in 4 seperate text fields. 

The user can type in their own information into 4 seperate text boxes

I would like that info to be combined and put into a list in another text box.

Example:

Text field 1 : user input text 1 

Text field 2: user input text 2 

Text field 3: user input text 3 

 

Seperate Text Field (would auto generate list)

user input text 1

user input test 2

user input text 3 

 

Thank you! 

 

This topic has been closed for replies.
Correct answer Thom Parker

Simply concatonate the fields using a calculation script 

 

event.value = this.getFeild("Text field 1").value + this.getFeild("Text field 2").value + this.getFeild("Text field 3").value;

 

This works for numbers or string, but since it's string, I would do this differently.

Name the fields with group nameing, "Text.Field1" , "Text.Field2", etc.

then use this script

 

event.value = this.getField("Text").getArray().map(function(a){return a.value}).join("\n");

 

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
February 21, 2020

Simply concatonate the fields using a calculation script 

 

event.value = this.getFeild("Text field 1").value + this.getFeild("Text field 2").value + this.getFeild("Text field 3").value;

 

This works for numbers or string, but since it's string, I would do this differently.

Name the fields with group nameing, "Text.Field1" , "Text.Field2", etc.

then use this script

 

event.value = this.getField("Text").getArray().map(function(a){return a.value}).join("\n");

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often