For loop when reading inputs from checkboxs
Greetings All,
So the premise is I'm trying to create a print button which checks which buttons are checked off, then prints off the ones which are checked off.
I've got the following code so far:
//The following code outputs which page numbers to print based off of checkbox into Field "Print_pages"
//all checkboxes are named "print1", "print2", print3", etc.
//initial page which will always print
var output = "[0,0]";
event.value = output;
//conditional pages, the output for each checkbox is in ",[1,3]" format
if(this.getField("print1").isBoxChecked(0) == "1"){
event.value += this.getField("print1").value;
}
if(this.getField("print2").isBoxChecked(0) == "1"){
event.value += this.getField("print2").value;
}
if(this.getField("print3").isBoxChecked(0) == "1"){
event.value += this.getField("print3").value;
}
// etc. etc.
//
//
// Print button
var pp = this.getPrintParams();
pp.printRange=[this.getField("Print_pages").value];
this.print(pp);
Question) Is there anyway to condense the if statement into a for loop in above code until there are no more print checkbox fields?
