If i use the multiple Checkbox Input, It results in list of the items
which were selected.

My question is can you do the same thing for a single checkbox?

As an old ASP guy I'd do this:

<input type="checkbox" value="EN" name="el1">


I'm trying to do this in django by the following:




#...snip forms.py
el1_Choices = (
    ('EN', 'ENGLISH'),
)

    el1=forms.ChoiceField (required=False, choices=el1_Choices,
widget=forms.CheckboxInput(attrs={'class':'multibox'}) )


The resulting HTML is:

<input id="id_el1" class="multibox" type="checkbox" name="el1"/>


As you can see there is no value.  It is returning the following
error:

Select a valid choice. That choice is not one of the available
choices.

Even though I've got the form field setup to required=False.




What is the proper way to assign a value to a single checkbox?  Am I
just stuck with boolean and true/false?  That seems like a lot of
extra work on the back end.


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

Reply via email to