Hi everyone!
I am using a JS code to show/hide template pages using a checkbox, but if a user unchecks the box or checks it again, the template page keeps appearing and appearing. I'd like to hide the page if the box is unchecked AND the page is empty.
Here is the code I'm using:
var sName = "UM_Master";var a = this.templates;for (i = 0; i < a.length; i++) {if(a[i].name == sName) {a[i].spawn(this.numPages, false, false);break;}}
First my variables are:
UM_Check = checkbox (located on page 1)
UM_Master = template (appears on page 2 if UM_Check is checked)
UMPg2_TXT = text field a user fills in on UM_Master
What I want to do is this:
When a user checks UM_Check, the UM_Master template appears on page 2 (which is the JS above). If a user made a mistake by choosing that option, the UM_Master template page should hide. (With the above JS, if a user unchecks the box a new UM_Master page appears.) Before the page is hidden, I want JS to first make sure nothing was written in UMPg2_TXT on UM_Master.
So.....
If UM_Check is unchecked AND if the UMPg2_TXT field is empty on UM_Master, then hide UM_Master; else, if UM_Check is unchecked AND if the UMPg2_TXT field is NOT empty, keep UM_Check checked and display warning, "Delete Text on UM_Master first before unchecking this box."
Is this possible? Can someone help me with this?
Thanks so much,
Chellie
George Kaiser