Hi. I'm writing a script that will hide certain fields when a check box is checked. The fields are incremental, in that they have the same name, except for a different number on each one. Here is an example of the script. As you can see, the fields have a number in them, e.g. "RemedialDate3."

Is it possible to add JS that will increment the numbers, so I don't have to have every single field listed? (RemedialDate1, RemedialDate2, RemedialDate3, etc.)


var Remedialcheck = this.getField("chkRemedialActions")

var RemDes = this.getField("txtRemedialDescription1")

var RemDate = this.getField("RemedialDate3")

var RemedEff = this.getField("txtRemedEffect1")

var RemEffDate = this.getField("RemedialDate3")



if (Remedialcheck.isBoxChecked(0) == true) {

RemDes.hidden = true;

RemDate.hidden = true;

RemedEff.hidden = true;

RemEffDate.hidden = true;

}

if (Remedial check.isBoxChecked(0) == false) {

RemDes.hidden = false;

RemDate.hidden = false;

RemedEff.hidden = false;

RemEffDate.hidden = false;
}