Copy link to clipboard
Copied
I have a drop down list with several classes listed called "Class 1" (Biology 30, Psychology 30 etc.) in one cell and I have a separate cell called Course 1 that I want the class code to appear. (Biology would be 8255 and Psychology would be 8340, etc) So I want it to recognize the chosen option selection from the drop down list in the first cell (Class 1) and auto-assoicated the choice with the correct choice and place in the second cell (Course 1) - therefore "Biology 30" would be the choice chosen in the first cell and I want the class code associated with Biology "8255" to appear automatically in the Course 1 cell How do I do this - and is it an Action or Format script?
Copy link to clipboard
Copied
Give export value to your options in dropdown field, give "Biology" export value "8255" (export value is right under where you add items for dropdown in dropdown field -> properties -> options tab)
and then as calculation script of "Course 1" field use this code:
event.value = this.getField("Class 1").value;
Copy link to clipboard
Copied
Got it to work. Thanks so much for your support!
Copy link to clipboard
Copied
Another aproach would be to separate out the course code from the complete selection text. For this technique there are no export values. There are several options for doing this, but the easiest is using the split function. Also, since the value of the course code field is set from a single location, a calculation script is not necessary. You should avoid using calculation scripts whenever possible.
Place this code in the Custom Validation Script for the drop down field. The code assumes the field in the second cell is named "Course 1". You'll need to change this to match the field name on your form.
this.getField("Course 1").value = event.value.split(" ").pop();