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

PDF Dropdown export value multiple values?

New Here ,
Mar 18, 2020 Mar 18, 2020

Hello There,
I'm creating a project initiation form. I intent to have the approver name autopopulate based on the business division selected from a drop down list.

I understand that to have the text feild autopopulate I will write code that says event.value=this.getField("dropdown item name").value. I also understand that I enter the export value in the dropdown item options.

Is there a way to enter multiple export values? In my approval process, I need the form to the signed by person A and person B. I would like to have text box 1 populeate with approver A's name and text box 2 populate with approver B's name. Is that possible?

Thank you!

TOPICS
PDF forms
1.6K
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
LEGEND ,
Mar 18, 2020 Mar 18, 2020

The export value of a dropdown item can be any string you want. If you use a specific character to delimit the names within the string, you can use a script to separate them and populate the text boxes with the names. For example, if the export value for an item is the string:

 

"Jimmy Buffett|Steve Goodman"

 

which uses the pipe character as the delimiter, you could set up the first name field with the following custom calculation script:

 

 

// Custom calculate script for 1st name field
(function () {

    // Get the value of the dropdown, as a string
    var sNames = getField("Dropdown1").valueAsString;

    // Attempt to parse two separate strings into an array
    var aNames = sNames.split("|");

    // Get a reference to the 2nd name field
    var f2 = getField("Name2");

    if (aNames.length === 2) {  // If two strings were extracted from dropdown value
        event.value = aNames[0];  // Populate this field with the first name
        f2.value = aNames[1];  // Populate the 2nd name field
    } else {  // Only 1 or zero strings could be extracted from dropdown value...
        event.value = "";  // Blank this name field
        f2.value = "";  // Blank the 2nd name field
    }

})();

 

 

You will have to change the field names in the code to match the actual names of the dropdown and 2nd name field. You will also have to include a pipe character in the export value of each item at the end of the first name even if there's only one name.

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 ,
Mar 19, 2020 Mar 19, 2020
LATEST

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