I want to add a boolean field to a custom type node. I added a field of type integer and I selected widget single on/off checkbox. The problem is that in the DB the field is always not set. Do you have any idea for adding a boolean field?

Comments

AdrianB’s picture

I think this is how you create a boolean field:

1) Create an integer CCK field
2) Choose "Single on/off checkbox" as widget
3) In the "Allowed values list" add the following:

0|label_off
1|label_on

You can replace label_off and label_on with whatever you like, but keep the 0 and 1.

I was searching for some good instructions on how to make boolean fields and couldn't find any. It wasn't until I found this issue about a better UI for adding boolean fields I realize the part about key|label.