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

multi-line textbox into a dropdown

Community Beginner ,
Sep 01, 2023 Sep 01, 2023

Is there a way to export a multi-line textbox into a dropdown? 

 

Chat GPT gave me this, but it did not work

 

var multilineTextField = this.getField("MultilineTextField"); // Replace with the actual name of your multiline text field
var dropdownField = this.getField("YourDropdownFieldName"); // Replace with the actual name of your dropdown field

var optionsText = multilineTextField.value;
var options = optionsText.split("\n");

dropdownField.clearItems();

for (var i = 0; i < options.length; i++) {
    dropdownField.addItem(options[i]);
}

 

 

TOPICS
Create PDFs , General troubleshooting , PDF , PDF forms
700
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 ,
Sep 02, 2023 Sep 02, 2023
LATEST

Use this:

var multilineTextField = this.getField("MultilineTextField").valueAsString.split(/[\r\n]+/);
this.getField("YourDropdownFieldName").clearItems();
this.getField("YourDropdownFieldName").setItems(multilineTextField);

View solution in original post

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 ,
Sep 02, 2023 Sep 02, 2023

addItem doesn't exist in Acrobat.

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 ,
Sep 02, 2023 Sep 02, 2023

Yea chatgpt, tried some solution, not sure if the above is possible tho

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 ,
Sep 02, 2023 Sep 02, 2023
LATEST

Use this:

var multilineTextField = this.getField("MultilineTextField").valueAsString.split(/[\r\n]+/);
this.getField("YourDropdownFieldName").clearItems();
this.getField("YourDropdownFieldName").setItems(multilineTextField);
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