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

davidburns’s picture

blueblade’s picture

Hi davexoxide,

Thanks for your help. I have just installed Checkbox Validate and set up an CCK "Integer" field with

0|Off
1|text text text. 

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

jethro’s picture

I am having the same issue before and after trying the above module. Did anyone get this to work?

grendzy’s picture

Component: General » optionwidgets.module
Category: task » bug

the 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.

larskleiner’s picture

I put up a patch at http://drupal.org/node/768732 which adds optionwidgets_onoff support to the checkbox_validate module.

tim.plunkett’s picture

Status: Active » Closed (duplicate)

The original support request was fixed, marking this as a dupe of #768732: Add optionwidgets_onoff support

amaisano’s picture

This 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.

thomasmurphy’s picture

You 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.

marleo’s picture

thomasmurphy: Excellent. Never would have occurred to me. Thanks.