Should I use 'setItems' statement approach or the 'switch' statement apoproach?

What would be the most efficient way to script this out?:

Dropdown1 box = “SummerHrs”…with options at 0.0, 2.0, 2.5, 3.0, 3.5, -> 15.0.
Dropdown2 box = “Semesters”…with options @ “Fall”, Fall+Spring”, “Fall+Spring+Summer”, “Spring”, “Spring+Summer”, “Summer”.

Example:

Student selects 0.0 summer hours (0.0 = the default).

THEN

When pulling up the dropdown2 for Semesters, only the “Fall”, “Fall+Spring”, and “Spring” options appear, considering that there are NO summer hours selected, hence, a Summer semester does not come into the equation, as it were.

ELSEWISE, any number >=2.0 from dropdown1 “SummerHrs” would show all Semester options.

What would be the most efficient way to script this out? Thanks in advance!


John Forest


Voted Best Answer

You can use something like this as the custom validation script of the first field:

if (event.value=="0.0") this.getField("Dropdown2").setItems(["Fall", "Fall+Spring", "Spring"]); // etc.

.


Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


By Gilad D (try67)   


Please specify a reason: