Grey out other checkboxes My scenario looks as follow: I have a form element of checkboxes, e.g. 3. If the rightmost checkbox is marked, the other 2 are greyed out and so on. I don't know how to do this, because if I use the #disabled property all of them are greyed out.

I thought about to make several single checkboxes of type #checkbox and use an ajax call and look at the $form_state and rerender all of them as single ones (disable them then etc.). But there is a problem that I use a form in a drupal block, and I haven't got the &amp;$form_state as a parameter of the function.

What is the best method to do this?
This question is not exactly related to drupal.

Still you can use jQuery to make it work.

Just get the wrapper class of parent element

jQuery('#edit-field-hobby-und .form-checkbox').click(function(){
  jQuery("#edit-field-hobby-und .form-checkbox").each(function(){
  jQuery(this).attr('disabled',true);

  });
  jQuery(this).removeAttr('disabled','disabled')
})


Here form-checkbox is the class of the checkboxes and edit-field-hobby-und is the id of its wrapper.

Hope it will help!