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.
Hi,
I am using Drupal 6.15 and CCK 6.x-3.x-dev. I am trying to add a required single check box so that the users can check on something like " I certify that I have the right to distribute these photos and that they do not violate the Terms of Use." (from facebook)
I figured out how to add an on/off single checkbox but dont know how to make that a required field...any help will be appreciated =)
Thanks and have a great day.
BB
Comments
Comment #1
davidburnshttp://drupal.org/project/checkbox_validate
Comment #2
blueblade CreditAttribution: blueblade commentedHi davexoxide,
Thanks for your help. I have just installed Checkbox Validate and set up an CCK "Integer" field with
in the "Allowed values list" box but the single check box is still not set as required. I read the "Read me" file that comes with Checkbox Validate but didnt see anything else that it says I need to do. Do you have any idea what I may be missing here? I am using Drupal 6.15.
Thanks again.
BB
Comment #3
jethro CreditAttribution: jethro commentedI am having the same issue before and after trying the above module. Did anyone get this to work?
Comment #4
grendzy CreditAttribution: grendzy commentedthe checkbox_validate module doesn't work here, because the single checkbox doesn't use the checkbox FAPI element - it creates it's own called "optionwidgets_onoff".
You can workaround this by using a regular option/radio widget. Set it to required, unlimited, and provide only one allowed value. (you still need the checkbox_validate module with this approach). BTW I'm using 2.6, I haven't verified this bug exists in 3.x.
Comment #5
larskleiner CreditAttribution: larskleiner commentedI put up a patch at http://drupal.org/node/768732 which adds optionwidgets_onoff support to the checkbox_validate module.
Comment #6
tim.plunkettThe original support request was fixed, marking this as a dupe of #768732: Add optionwidgets_onoff support
Comment #7
amaisano CreditAttribution: amaisano commentedThis workaround was perfect for me (#4) - thanks! I am running 6.x-3.0-alpha3+13-dev of CCK, but still had the same buggy single on/off checbox issues.
Comment #8
thomasmurphy CreditAttribution: thomasmurphy commentedYou can do this without checkbox_validate. Just create a textbox/radio button cck field, make it required, set it to allow 2 values. Only put one "1|agree" in the allowed values, but leave the default value unchecked. Now when the form is submitted it will refuse the submission and specify that the terms are required unless the user selects the option.
Comment #9
marleo CreditAttribution: marleo commentedthomasmurphy: Excellent. Never would have occurred to me. Thanks.