I have a series of checkboxes on a form (each of which requires some additional information to be entered) and a series of text boxes further down the page to house any necessary detailed information.
I have hidden the detail fields and coded the form so that for each of these checkboxes that is checked a row of detail text boxes appears with the checkbox title in the activiy type field, and if a checkbox is subsequently un-checked the last row of detail text boxes is hidden.
The problem with this is that if the user unchecks any box other than the most recently checked one the data for the option they just unchecked still shows, but the data for the last option they selected does not.
Does anyone have a solution that would make sure the detail fields for the boxes that are checked is displayed in the detail text boxes that are showing when a checkbox is unchecked, regardless of the order in which the boxes are checked/unchecked?
This is what my form looks like, with the example where Cash Withdrawals is unchecked but appears in the detail and Remote Deposit Capture is checked but was hidden with the last line:
The detail groups are named Act1.child, Act2.child, etc. where the description field (filled in the example above) is Act1.type, Act2.type, etc.
Here is the script I'm using on the checkboxes to achieve what I'm getting now:
var useSet = this.getField("Set").value;
var clrSet = this.getField("Clr").value;
var useType = useSet + ".type";
var clrType = clrSet + ".type";
if (this.getField("CheckboxName").value != "Off") {
this.getField(useType).value = "Check Box Desription";
this.getField(useSet).display = display.visible;
}
else if (this.getField("CheckboxName").value == "Off") {
this.getField(clrType).value = "";
this.getField(clrSet).display = display.hidden;
}
and here is the script for the hidden boxes that determine what sets are filled and what sets are cleared and hidden:
Custom Calculation Script for "Set":
var sOne = this.getField("Act1.type").value.length;
var sTwo = this.getField("Act2.type").value.length;
var sThr = this.getField("Act3.type").value.length;
var sFour = this.getField("Act4.type").value.length;
var sFive = this.getField("Act5.type").value.length;
var sSix = this.getField("Act6.type").value.length;
var sSev = this.getField("Act7.type").value.length;
if (sOne == 0) {event.value = "Act1"}
else if (sTwo == 0) {event.value = "Act2"}
else if (sThr == 0) {event.value = "Act3"}
else if (sFour == 0) {event.value = "Act4"}
else if (sFive == 0) {event.value = "Act5"}
else if (sSix == 0) {event.value = "Act6"}
else {event.value = "Act7"}
Custom Calculation Value for "Clr":
var cOne = this.getField("Act1.type").value.length;
var cTwo = this.getField("Act2.type").value.length;
var cThr = this.getField("Act3.type").value.length;
var cFour = this.getField("Act4.type").value.length;
var cFive = this.getField("Act5.type").value.length;
var cSix = this.getField("Act6.type").value.length;
var cSev = this.getField("Act7.type").value.length;
if (cSev != 0) {event.value = "Act7"}
else if (cSix != 0) {event.value = "Act6"}
else if (cFive != 0) {event.value = "Act5"}
else if (cFour != 0) {event.value = "Act4"}
else if (cThr != 0) {event.value = "Act3"}
else if (cTwo != 0) {event.value = "Act2"}
else {event.value = "Act1"}