I've been trying to use #ajax callbacks on a form. I've got this working with radio buttons, so when I've debugged the form I get the value associated with the radio button as '#value' under 'triggering_element' in $form_state; what I'm struggling with is doing the same thing with a group of checkboxes. The first checkbox checked seems to work correctly, and I can see the correct value, but if I click a second checkbox, the value doesn't come through correctly (triggering element is the field that was returned in the previous #ajax callback for some reason??) and '#value' is a string and not an array as I would have expected. Also $form_state['#values'] doesn't contain the previously selected checkbox or the current checkbox.
How do you correctly add #ajax to an element of type 'checkboxes' and how is it possible to get the value of all checked checkboxes when the ajax callback is fired?