A better script to hide and display a large amound of feilds
Hello,
I have 20 fields (check boxes) that can be hidden/visible based upon the value of a textfield (Counter). My script works fine, but, it's really long (161 lines) and there is a slight lag when I press a button that changes the value of the counter. My script is a caculation script attached to a hidden textfield. Is there a better way to write this script? Here is what I have:
var c = this.getField("Counter");
var b1 = this.getField("Blah 1");
var b2 = this.getField("Blah 2");
var b3 = this.getField("Blah 3");
// etc etc. down to 20
if(c.value == "1"){
b1.display = display.visible;
}
else {
b1.display = display.hidden;
}
if(c.value == "2"){
b2.display = display.visible;
}
else {
b2.display = display.hidden;
// etc etc. down to 20