Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I want to create a list of content sorted by checkbox value.
I've created a Single on/off checkbox with
Field type integer
Widget type: single on/off checkbox
In Allowed Values:
0 | no
1 | yes
In node edit checkbox state is always unchecked - 0. In node view the checkbox shows up on the node correctly. If I don't check it, the value remains 0. Then, if I check it, the value becomes 1. The fields are stored well in de DB and show up when loaded in Devel.
but in node edit checkbox is always 0 | no after I set checkbox to yes.
Comments
Comment #1
yched CreditAttribution: yched commentedWas fixed post RC4.
Please grab latest 6.x-2.x dev release.
Also note that assigning an issue to yourself means you intend to work on the fix yourself. Probably not what you meant.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
fnapo CreditAttribution: fnapo commentedSorry to reopen this, but, I have the same issue now with the latest version.
How do I make drupal get the value and show me a checked box in the edit form if it is set to 1?
thanks
Comment #4
jyg CreditAttribution: jyg commentedYep, I am seeing it in 2.8 as well.
Comment #5
jospBln CreditAttribution: jospBln commentedsubcribe
0 | off
1 | on
stores correct in database, but has always to be set again when editing the node.
Comment #6
chipcleary CreditAttribution: chipcleary commentedSubscribe. I have the same issue.
Comment #7
jolos CreditAttribution: jolos commentedIf you're encountering this issue ( as I did ), please ensure that you use:
0|no
1|yes
instead of:
0 | no
1 | yes
I'm setting this issue to closed as this is working in the latest version.
Comment #8
jimboh CreditAttribution: jimboh commentedI am using 6.27 and I have a content type with a checkbox field set as
0|No
1|Yes
No spaces
I have a custom form that displays a list of checkboxes, one for each of the nodes (of the content type that has the select). Changing the state of the checkboxes in the list changes the value in the database correctly but when the individual node is displayed the value has not changed.
What I found is that if I went to manage fields and re-saved the checkbox field (no changes), when each node was refreshed the value would change (no amount of refreshing would get it to change without re-saving the field first).
When I change the value from 0 to 1 or 1 to 0 directly in the database with phpadmin my custom list checkboxes display correctly, the node checkbox does not.