costar Posted December 23, 2015 Report Share Posted December 23, 2015 i have a field on a submission data page which if checked will display other other fields to be checked which have been hidden by a rule, but if I un-check the parent field the children fields disappear but remain checked. Can I use JS to clear the children cells if the parent is un-checked? many thanks Quote Link to comment Share on other sites More sharing options...
iren Posted December 23, 2015 Report Share Posted December 23, 2015 Hello costar, You can use following code in the footer field: <SCRIPT type="text/javascript"> function f_a(v_id){ return document.getElementById(v_id); } function f_b(v_id){ return f_a('InsertRecordcheckbox' + v_id);} function f_findParentTR(v_node){ var v_parentNode = v_node; if(!v_node) return null; while(v_parentNode && String(v_parentNode.nodeName).toUpperCase() != 'TR') v_parentNode = v_parentNode.parentNode; return v_parentNode; } function CheckboxesCheck() { if (f_b("1").checked){ f_b("2").checked=true; f_b("3").checked=true; } else { if(!f_b("2").checked){ f_findParentTR(f_b("2")).style.display='none'; } if(!f_b("3").checked){ f_findParentTR(f_b("3")).style.display='none'; } } } f_b("1").onchange=CheckboxesCheck; </script> Note: The code works for three fields with 'Yes/No' DataTypes. Hope it helps. IREN Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.