Wednesday, August 1, 2012

Checkbox checking

Hi,

My checkboxes are giving me grief.

I want to make it required for the user to check a checkbox before being allowed to submit a forms.

I'm using model forms so the checkbox is defined as a models.BooleanField in my models.py. I have included blank=False, though this should be the default.

In the admin the checkboxes aren't required to be checked. When displaying the form in a template I can set required="True" as follows: <input type="checkbox" required="True" check_test="True" name="involved" id="id_involved"/>

This works in most browsers, though not Safari for some reason.

Is there a better method? I've messed around with this for ages!

Thank you in advance.

Jon

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/4bBr_gr_Z44J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment