I want to add fields in my node which will contain boolean values only : Yes/No. Selecting boolean as field type will cause the field to show up as single check box and in the node edit form I've difficulty in locating boolean type field.

Currently I'm using List(Text) and giving values as 1|Yes & 0|No.

What is the right way to use boolean values?

  • 1
    look in to this drupal.org/project/boolean
    – Bala
    Jun 1 '13 at 5:44
  • 1
    but very less people using it ..
    – AgA
    Jun 1 '13 at 5:46
  • It depends on user needs
    – Bala
    Jun 1 '13 at 5:48
  • I want to look for solution from core fields only initially. If it does not work out then only I should go for user modules.
    – AgA
    Jun 1 '13 at 7:28
  • 4
    "Selecting boolean as field type will cause the field to show up as single check box" Yep, that's exactly what should happen. What problem is that causing you exactly, and what are you trying to achieve? If you're looking for a boolean field, that's what Drupal core provides. If you need a more advanced pseudo-boolean field (i.e. the 'Yes/No' select box that you mention) then you're already doing it the correct way by using a text list field.
    – Clive
    Jun 1 '13 at 11:10

As follows:

  • Field type: List (integer) & Widget: Check boxes/radio buttons
  • Values: 1|Yes
  • Number of values: unlimited

See drupal.org


I would create:

  1. List (Text) with the Check boxes/radio buttons widget
  2. Make two options: 1|Yes and 2|No
  3. Number of values: 1
  4. Most importantly: put the field on Required. This way you get radio buttons where only one option can and must be selected.

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