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

Export two values from a drop down.

New Here ,
Jun 09, 2016 Jun 09, 2016

I've created a dropdown field with courses. Can I export two values to different fields in the same form? One is the price, the other is the maximum number of people allowed to attend.

TOPICS
Acrobat SDK and JavaScript
383
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 ,
Jun 09, 2016 Jun 09, 2016

Yes, you can, but it requires using a script.

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 ,
Jun 09, 2016 Jun 09, 2016

Thanks. I've now duplicated the dropdown. So I have one with the courses and their export values as the price. The other is the courses and the maximum delegates allowed is the export value. The second dropdown will be hidden.

Do you know what the script would be?

The names of both dropdowns are "course" and "HiddenDropdown"

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 ,
Jun 09, 2016 Jun 09, 2016
LATEST

You don't need to do that. In fact, it just makes things more complicated.

One way of achieving this is to use a script as the custom validation script of the drop-down. You didn't provide any field names or actual values, so I'll just invent some:

if (event.value=="Option 1") {

    this.getField("Price").value = 100;

    this.getField("MaxAttendance").value = 20;

} else if (event.value=="Option 2") {

    this.getField("Price").value = 120;

    this.getField("MaxAttendance").value = 35;

} else if (event.value=="Option 3") {

    this.getField("Price").value = 200;

    this.getField("MaxAttendance").value = 50;

// etc.

} else {

    this.getField("Price").value = "";

    this.getField("MaxAttendance").value = "";

}

The only other thing to do is to make sure that the option to commit the selected value immediately under the dropdown's Properties - Options tab, is ticked.

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