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

Auto-populate list based on text fields with user input

Explorer ,
Feb 21, 2020 Feb 21, 2020

Copy link to clipboard

Copied

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! 

 

TOPICS
Acrobat SDK and JavaScript

Views

551

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Feb 21, 2020 Feb 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");

 

Votes

Translate

Translate
Community Expert ,
Feb 21, 2020 Feb 21, 2020

Copy link to clipboard

Copied

LATEST

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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