|
Before I added the updateCookie function to this html, this code works fine like it is intended to do. It enables a checkbox while disabling the subsequent ones. But the problem that I am having now is when a check is placed on a checkbox and you click the save button to save that record, the checkbox becomes unchecked. I am trying to ensure that once a check is placed on a checkbox, that that checkbox remains checked even after you close and reopne the page. I am having problem doing this with a cookie. Can I get your help, please?
<HTML> <HEAD> <TITLE>enable</TITLE> <script language="javascript"> <!-- var numOfBoxes = 8; function enable(inBox) { if (!document.forms['myForm']['cb' + inBox].checked) { // If the user unchecked a box, then disable all after it for (var i = inBox + 1; i <= numOfBoxes; i ++) { document.forms['myForm']['cb' + i].checked = false; document.forms['myForm']['cb' + i].disabled = true; } } else { // User checked a box, so enable the next document.forms['myForm']['cb' + (inBox+1)].disabled = false; } } //--> </script>
<script language="javascript"> <!-- function updateCookie() { document.cookie=document.myForm.cookie.value location.reload(true) } //--> </script>
</HEAD> <BODY> <form name="myForm"> <table> <tr> <td>Identify Objectives <input type="checkbox" name="cb1" id="cb1" onClick="enable(1),updateCookie()" >
Evaluate Requirements <input type="checkbox" name="cb2" id="cb2" onClick="enable(2),updateCookie()" DISABLED>
Design <input type="checkbox" name="cb3" id="cb3" onClick="enable(3);updateCookie()" DISABLED>
Initial Draft <input type="checkbox" name="cb4" id="cb4" onClick="enable(4),updateCookie()" DISABLED>
Review <input type="checkbox" name="cb5" id="cb5" onClick="enable(5),updateCookie()" DISABLED>
Revision <input type="checkbox" name="cb6" id="cb6" onClick="enable(6),updateCookie()" DISABLED>
Final Production <input type="checkbox" name="cb7" id="cb7" onClick="enable(7),updateCookie()" DISABLED>
Documentation <input type="checkbox" name="cb8" id="cb8" DISABLED> </td>
</tr> </table> </form> </BODY> </HTML>
|