Copy link to clipboard
Copied
I'm looking to make a drop down list to based upon a selection to open or close um a text field position so for example if I want field text 1 and 2 to open when B is selected but close off when C is selected but opens up number 4 how would I do that, thank you.
Copy link to clipboard
Copied
Sure. Here's a sample code (to be used as the custom Validation script of the drop-down field):
if (event.value=="B") {
this.getField("Text1").readonly = false;
this.getField("Text2").readonly = false;
} else {
this.getField("Text1").readonly = true;
this.getField("Text2").readonly = true;
this.resetForm(["Text1", "Text2"]);
}
Copy link to clipboard
Copied
Does this work within other scripts like.
var dropdownValue = this.getField("Age").value;
switch (dropdownValue) {
case "Child (0-15)":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = "-10"
this.getField("INS4").value = "-10"
this.getField("CHA4").value = "10"
this.getField("LUCK4").value = "10"
this.getField("Age1").value = "X"
this.getField("Age2").value = "X"
this.getField("Age3").value = "X"
this.getField("Age4").value = "X"
break;
case "Youth (16-29)":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = "-5"
this.getField("INS4").value = "-5"
this.getField("CHA4").value = "5"
this.getField("LUCK4").value = "5"
this.getField("Age2").value = "X"
this.getField("Age3").value = "X"
this.getField("Age4").value = "X"
break;
case "Middle (30-45)":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = ""
this.getField("INS4").value = ""
this.getField("CHA4").value = ""
this.getField("LUCK4").value = ""
this.getField("Age3").value = "X"
this.getField("Age4").value = "X"
break;
case "Mature (46-59)":
this.getField("STR4").value = "-5"
this.getField("FOR4").value = ""
this.getField("INT4").value = "5"
this.getField("INS4").value = "5"
this.getField("CHA4").value = "-5"
this.getField("LUCK4").value = ""
this.getField("Age4").value = "X"
break;
case "Geriatric (60+)":
this.getField("STR4").value = "-10"
this.getField("FOR4").value = "-10"
this.getField("INT4").value = "10"
this.getField("INS4").value = "10"
this.getField("CHA4").value = "-10"
this.getField("LUCK4").value = "10"
break;
case "-Select-":
this.getField("STR4").value = ""
this.getField("FOR4").value = ""
this.getField("INT4").value = ""
this.getField("INS4").value = ""
this.getField("CHA4").value = ""
this.getField("LUCK4").value = ""
this.getField("Age1").value = "N/A"
this.getField("Age2").value = "N/A"
this.getField("Age3").value = "N/A"
this.getField("Age4").value = "N/A"
break;
}
Copy link to clipboard
Copied
i want the age#s parts to be the ones that close or open