Template Pages - Prefixes and javascripts with checkboxes
My form has a 14 checkboxes that turns the visibility on/off of two corresponding fields each. One field is an image field, the second field is a test field. The reason is if someone doesn't have an image then the text is to display.
The scipt i have on the checkbox is working well:
//checkbox on/off toggle visibility
if (event.target.isBoxChecked(0)){
this.getField("Image1_af_image").display = display.hidden;
this.getField("AskDetails1").display = display.visible;
} else {
this.getField("Image1_af_image").display = display.visible;
this.getField("AskDetails1").display = display.hidden;
}
The form also has an "add page" button with a template page applied to it. The template page is identical to the first page with the exeption that all the additional fields have numbering continuing on from 15 to 28. (example "AskDetails15" and "Image15_af_image")
Each checkbox again has the same javascript to toggle visibility on/off:
//checkbox on/off toggle visibility
if (event.target.isBoxChecked(0)){
this.getField("Image15_af_image").display = display.hidden;
this.getField("AskDetails15").display = display.visible;
} else {
this.getField("Image15_af_image").display = display.visible;
this.getField("AskDetails15").display = display.hidden;
}
Which of course functions on the template page itself but not on the generated pages which now each field has the prefix (example) P2.Template.AskDetails15.
How do I write the script to include the variable prefix number?