Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more