Copy link to clipboard
Copied
Hi, is it possible to setup a form as per my example below?
I have 3 dropdowns (Course, Course Duartion and Course Code).
I would like to have it so the outcome of the course code selection is determinded by the choices selected on Course and Course duration.
For examples If you choose course A and a duration of 1 day, it auto selects Code A from the dropdown list options.
CODE + DURATION = CODE
A + 1 day = code A
A + half day = code b
B + 1 day = code c
and so on. Does thatc make sense and can it be done?
You can use something like this as "Custom calculation script" of 3rd dropdown (Course code):
var c1 = this.getField("Course").valueAsString;
var c2 = this.getField("Course Duration").valueAsString;
if(c1 == "A" && c2 == "1 day")
event.value = "Code A";
else if(c1 == "A" && c2 == "half day")
event.value = "Code B";
else if(c1 == "B" && c2 == "1 day")
event.value = "Code C";
else event.value = "";
If you don't select choices from 3rd dropdown manually you can use text field instead.
Did you check "commit selected value immediately" in dropdown properties -> options tab?
Also check if all field names and values are correctly spelled.
If you still have problems share your file here or send it to me via PM and Il take a look into it.
Copy link to clipboard
Copied
You can use something like this as "Custom calculation script" of 3rd dropdown (Course code):
var c1 = this.getField("Course").valueAsString;
var c2 = this.getField("Course Duration").valueAsString;
if(c1 == "A" && c2 == "1 day")
event.value = "Code A";
else if(c1 == "A" && c2 == "half day")
event.value = "Code B";
else if(c1 == "B" && c2 == "1 day")
event.value = "Code C";
else event.value = "";
If you don't select choices from 3rd dropdown manually you can use text field instead.
Copy link to clipboard
Copied
Perfect, I'll give this a go and let you know.
Thank you!
Copy link to clipboard
Copied
This seems to be working, but it will only populate the last option.
For instance on your example above it won't populate the value of Code A but only Code B.
You also have to select the text field to generate the info. Can it auto-populate the results by any chance?
Copy link to clipboard
Copied
Did you check "commit selected value immediately" in dropdown properties -> options tab?
Also check if all field names and values are correctly spelled.
If you still have problems share your file here or send it to me via PM and Il take a look into it.
Copy link to clipboard
Copied
Hi Nesa,
Thank you thats now working,.
The issue was else event.value = ""; at the end of the orginal code. Once i removed that, it worked fine and when I set commit selected as per above, that worked fine as well.
Thank you for your help, its greatly appreciated,