OK, I have a form where the first row of the first colum is a checkbox
designed to toggle the checked/unchecked state of all the other checkboxes
in the form (select all/select none).

Problem is, the state of the checkbox with the onclick state is not getting
changed.  The rest of the check boxes are toggling based on their current
state and I want to tie them to the "master" checkbox and I'm just not
getting this to work.

A sample page is here:
http://www.neighborhoodwatchalerts.com/invite/checkboxes.php

The code is this:
function toggleCheckBoxes(formName)
{
// toggle Check Boxes using Prototype Library
 var form = $(formName);
 var i = form.getElements('checkbox');
 var chkState = ($F('toggle_all') == "on") ? true : false;
// alert("chkState = " +chkState);  // show the current state

  i.each(function(item, chkState)
  {
//    item.checked = chkState;  // set all checkboxes to the masters state
//    if (chkState == false) // turn all checkboxes off
    if (item.checked)
    {
      item.checked=false;
    }
  else
    {
      item.checked=true;
    }
 }
  );
  return true;
}

Any thoughts or suggestions?  TJ, you have have any other shortcuts tucked
away?

Thanks,

Pete

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to