guitarguru83
New Coder
I'm sure this isnt pretty, im pretty new to Javascript, we have a PDF form and im trying to set it so the page corresponds to selections made from the drop down. Thus far the code just hides the text boxes and radio boxes regardless of what the user chooses.
JavaScript:
// Define the field names
var dropdownField = "Preferred Setup";
var textField0 = "MinimumRequirementTXT0";
var textField1 = "MinimumRequirementsTXT";
var radioField0 = "Minimum Requirements.0";
var radioField1 = "Minimum Requirements.1";
var radioField2 = "Minimum Requirements.2";
var radioField3 = "Minimum Requirements.3";
var radioField4 = "Minimum Requirements.4";
// Get the field objects
var dropdown = this.getField(dropdownField);
var text0 = this.getField(textField0);
var text1 = this.getField(textField1);
var radio0 = this.getField(radioField0);
var radio1 = this.getField(radioField1);
var radio2 = this.getField(radioField2);
var radio3 = this.getField(radioField3);
var radio4 = this.getField(radioField4);
// Add a "validate" event to the dropdown field
dropdown.setAction("Validate", "if (event.value == 'Your Organization: Stand Alone Workstation' || event.value == 'Your Organization:Client Workstation') {" + text0.name + ".display = display.visible;" + text1.name + ".display = display.visible;" + radio0.name + ".display = display.visible;" + radio1.name + ".display = display.visible;" + radio2.name + ".display = display.visible;" + radio3.name + ".display = display.visible;" + radio4.name + ".display = display.visible;} else if (event.value == 'Artel Laptop: Stand-alone laptop, software pre-installed' || event.value == 'Artel Laptop:Client laptop only (database on network), software pre-installed' || event.value == 'Artel Laptop:Nothing installed') {" + text0.name + ".display = display.hidden;" + text1.name + ".display = display.hidden;" + radio0.name + ".display = display.hidden;" + radio1.name + ".display = display.hidden;" + radio2.name + ".display = display.hidden;" + radio3.name + ".display = display.hidden;" + radio4.name + ".display = display.hidden;} else {" + text0.name + ".display = display.hidden;" + text1.name + ".display = display.hidden;" + radio0.name + ".display = display.hidden;" + radio1.name + ".display = display.hidden;" + radio2.name + ".display = display.hidden;" + radio3.name + ".display = display.hidden;" + radio4.name + ".display = display.hidden;}");