Case:
create a cck field, type Integer, widget off/on.
use these options:
0|No
1|Yeah
Create the content type, and then create a node from that type.
If you check the box you just created and press save, in the database you will find 1 as a value.
However, if you view the node, the box will be not ticked.
There is a work-around: that is to use a text type instead of Integer. That works fine.
Comments
Comment #1
markus_petrux commentedNope. It also works with intergers. We have a few of these working here. Maybe it is something else that causes this to not work in your installation?
Comment #3
greenskunkI have this same problem but it was my fault for leaving one important part out. I've had it on one site for over a year and didn't figure out what was going on until a little while ago. I had a brain fart and was wondering why I didn't fill out the Allowed Values List.
When you create an integer field with the checkbox widget be sure to set your Allowed Values List.
Example:
Then just add a little function to your template.php file
Comment #4
greenskunkI'm using this on a site for a Select List with the field type of Integer.
A select list works better for if you have a field and you don't have a Yes or No answer to.
Example:
Use case: Field for showing whether a location is handicapped accessible and the client wants to show the field even if they don't have an value. If the handicapped accessible location wasn't touched during the entry of a node then the field will show as 'Unknown' using the above phptemplate_checkbox_yesno() function.
Field Type: Integer
Widget Type: Select List (this will allow you to select None, clearing the field of any value, during data entry into a node)
Allowed Values List:
0|No
1|Yes
Hope this helps.
Comment #5
eddy147 commentedThank you, GreenSkunk :)