How to get Observer fields watching checkboxes

Imagine the classic department, employee relation construct (Employees,
Departments tables)

A department can have a number of employees, employees must belong to
one department, there are many departments)

I have two divs one contains a number of check boxes with the various

London [x] LA [x] Paris [x] Sydney [x] Tokyo [x] Rome [x] New York [x] Bangalore [x]
Bob | London Remy | Paris Chuck | New York Jen | Rome Ken | Tokyo Paul | London

The number of departments are variable and can change over time, so
“hard” coding observers are impossible


@departments = Department.find(:all)

<% for dept in @departments

<%= dept.dname <% check_box_name = "dept[" + + "][query]" %> <%= check_box_tag ( check_box_name,, :checked => true ) %> <%= observe_field (check_box_name, :frequency => 0.5, :update => :employee_list , :url => { :action => :filter_depart}, :with => "'exclude=' + escape(" + + ") + '&checked=' + escape(value)" ) %>

This actually works well when the users clicks (unchecks or checks) on
the check box of a department the controller action “filter_depart” is
called and by checking the parameter of “exclude” and the value of
“checked” it is possible to determine wich dept id was checked or
unchecked and the query to employee table can be filtered on this info.

In the example above if the user unchecks London, Bob and Paul will
disappear from the employee listing. Happy ROR and AJAX developer.

The problem is that if the user then unchecks another check box eg.
Rome, the filter_depart controller action is called and Rome, Jen is
removed. However London ( Bob and Paul) employees are retrived even if
Londons check box remains unchecked.

The reason is that the controller action filter_depart is called by the
observer upon the change of a single check box and the value parameters
exclude and checked apply only to that single check box rather than the
array of check boxes.

Is there anyway to have an observer field(s) notice any change to any
field(s) particularly those generated with the standard check_box_tag
processing and lauch a “submit_to_remote” , which will mean that all
params of the form (including all check boxes values) are available to a
given controller?

Is observe_form the correct way to go with this?