I have a series of check boxes on a form for users to select from. In some cases, the user may want to select all of the check boxes. For the cases when the user wants to select all of the boxes, I have a separate "master" check box with the script below attached to it as an action. When the user selects the "master" check box, all of the "slave" check boxes are selected. If the user unselects the "master" check box, all of the "slave" check boxes are unselected.
The issue I am seeing is that when a user selects any of the "slave" check boxes individually, the JavaScript Debugger console displays a "TypeError: f is null" message.
I do not know what the error means, or what, if any, action I need to take, since the script works as expected. Any advice on this would be appreciated.
Thanks in advance for your time.
// Get the value of this checkbox
var v1 = event.target.value;
// Names of subordinate check boxes
// and their associated export values
var cb_list = {
"chk_mkt_bos.0.0" : "1",
"chk_mkt_bos.1.0" : "1",
"chk_mkt_bos.2.0" : "1",
"chk_mkt_bos.3.0" : "1",
"chk_mkt_bos.0.1" : "1",
"chk_mkt_bos.1.1" : "1",
"chk_mkt_bos.2.1" : "1",
"chk_mkt_bos.3.1" : "1",
};
if (v1 != "Yes") {
// turn all other check boxes on
for (var cb_name in cb_list) getField(cb_name).value = cb_list[cb_name];
} else {
// turn all other check boxes off
for (var cb_name in cb_list) getField(cb_name).value = v1;
}