Skip to main content
Participant
June 9, 2016
Question

Export two values from a drop down.

  • June 9, 2016
  • 1 reply
  • 414 views

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.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 9, 2016

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

Participant
June 9, 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"

try67
Community Expert
Community Expert
June 9, 2016

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.