Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - persisting a checkmark
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

persisting a checkmark

 Post Reply Post Reply
Author
simflex View Drop Down
Groupie
Groupie
Avatar

Joined: 10 November 2002
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote simflex Quote  Post ReplyReply Direct Link To This Post Topic: persisting a checkmark
    Posted: 07 March 2003 at 12:29pm

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>

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2003 at 3:46pm
well, you have this line

document.cookie=document.myForm.cookie.value

but no where do you have a form field called "cookie"

i'm not even sure why you take this multiple checkbox route, it'd be so much easier to force them to go in steads with just flat out code, this code is too "cute", especially now that its 8 steps
Contribute to the working anarchy we fondly call the Internet
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.