I have a boolean field in my content type which takes values either 1 or 0. I want to provide a button instead of just displaying the value of field so that the user can click on it and toggle the value.

Is it possible to doing something like this ?

4 Answers 4


Maybe you should check out the Flag module. Out of the box this module will give you the boolean field, the ajax button on the node view, and rules integration.

The flag module integrates nicely with views. Here is some helpful documentation. http://drupal.org/documentation/modules/flag

You will no longer need the boolean field on your node though so, depending on existing content may require a migration.

It does have a very large user base too and it may save you some development.


If you want to submit a new value for the field on the actual toggle then you'll need to write a custom module with an ajax handler that saves that value for you.

If you just want to change the look of the field and can wait for the 'Save' button to be pressed to save the updated value you could probably do everything in CSS with maybe a bit of javascript if you want to make it look more slick.

  • I want to write an ajax handler... Can you point me to any tutorials on how to code it?
    – Jayaram
    Commented May 3, 2012 at 12:56
  • Is it also possible to use rules and the button field to do something like this ?
    – Jayaram
    Commented May 3, 2012 at 20:45
  • Are you on Drupal 6 or 7? Commented May 7, 2012 at 18:46
  • I use Drupal 7.
    – Jayaram
    Commented May 10, 2012 at 15:00
  • Ignore what I said and go with @thepearson 's answer Commented May 11, 2012 at 16:42

The best answer to this is to Use the Button-Field module and use rules to create actions when the button is clicked. The module already has integration with rules.


Fasttoggle may be what you want.

Speeds up common administration tasks like unpublishing or promoting nodes or blocking users through the use of AJAX callbacks. This saves lots of page loads. If JavaScript is not available, it degrades gracefully to a regular confirmation page.

  • I would gladly edit it, to provide relevant quote, but it seems linked module is for "common administration tasks", not for field values, and no part of it's description suggest it's relevant.
    – Mołot
    Commented May 7, 2014 at 6:28
  • Yes, it looks like this is not for fields. Another one only for properties is itoggle Commented Jul 16, 2014 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.