These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

What's wrong with this script?

Torvik
Registered: Mar 14 2007
Posts: 25

This script is used to alter one drop down box based on the data from the first drop down.

It worked earlier today, but then I made changes and saved it, and now it doesn't work. I think I undid all my changes, but I must be missing something obvious. Any idea what's wrong with this javascript?

if (this.rawValue == 0) {//SQ1
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");

} else (this.rawValue == 1) {//SD2
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
DropDownList2.addItem("Triple Occ", "2");
DropDownList2.addItem("Quad Occ", "3");
}

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
// an "else if"
if (this.rawValue == 0) {//SQ1
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");} else if (this.rawValue == 1) {//SD2
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
DropDownList2.addItem("Triple Occ", "2");
DropDownList2.addItem("Quad Occ", "3");
}// the "switch" statement

switch{ Str(this.rawValue)) {
case: "0": //SQ1
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
break;case "1": //SD2
DropDownList2.clearItems();
DropDownList2.addItem("Single Occ", "0");
DropDownList2.addItem("Double Occ", "1");
DropDownList2.addItem("Triple Occ", "2");
DropDownList2.addItem("Quad Occ", "3");
break;
default:
// error message can go here
break;
}

George Kaiser