Inspiring
July 8, 2022
Answered
Using a loop with switch event on text fields
- July 8, 2022
- 2 replies
- 1079 views
Is is possible to apply a loop into one text field, instead entering the following custom validation script into each Employee 1 to 5 text fields that switch the AbsencePayTypeDesc 1 to 5 fields? I've attached a simplified version of what I need but my actual PDF has 25 lines and it's a bit time consuming when I have to update it. Any help would be greatly appreciated. Thanks so much!
switch (event.value) {
case "Kerry":
var fields = ["AbsencePayTypeDesc1"];
for (var i in fields) this.getField(fields[i]).setItems([" ","Vacation (Kerry)","Sick (Kerry)"]);
break;
case "Derek":
var fields = ["AbsencePayTypeDesc1"];
for (var i in fields) this.getField(fields[i]).setItems([" ","Vacation (Derek)","Sick (Derek)"]);
break;}