Topic: checkboxes and onchange/observe_field


I have some checkboxes that call a function when they're checked/unchecked.
If a checkbox is checked/unchecked by clicking, this works just fine whether I call the function in the checkbox's onchange event or have an "observe_field" that calls the function.

I also have links which call javascript functions to check/uncheck all my checkboxes.
When I click these, the checkboxes all get checked or unchecked appropriately, but the function does not called in either case (whether i have an onchange or observe_field).

What is the appropriate way to trigger a checkbox state change with JS and detect the state change so that clicking my "check all" or "uncheck all" link will call the functions specified by each checkbox's onchange?


In my check all / uncheck all methods, I have code that iterates through all checkboxes and calls checkbox.checkon or checkbox.checkoff, which are defined like this:

    checkon: function(element) {
      $(element).checked = true;
      return true;
    checkoff: function(element) {
      $(element).checked = false;
      return true;

Re: checkboxes and onchange/observe_field


I have the very same problem. Did you find out the way to fix it ?