#16308: CheckboxSelectMultiple can not show the data on the view -------------------------------------+------------------------------------- Reporter: | Owner: nobody jekyllhy3@… | Status: closed Type: | Component: Forms Uncategorized | Severity: Normal Milestone: | Keywords: Checkbox Select Version: 1.3 | Multiple Resolution: | Has patch: 0 worksforme | Needs tests: 0 Triage Stage: | Easy pickings: 0 Unreviewed | Needs documentation: 0 | Patch needs improvement: 0 | UI/UX: 0 | -------------------------------------+------------------------------------- Changes (by BernhardEssl):
* status: reopened => closed * resolution: => worksforme * component: Documentation => Forms Comment: I had a look at your attached code and as I can see you missing the ''initial'' option. You can use ''initial'' to select values on a choice field like this: {{{ gender = forms.MultipleChoiceField(initial=['m'],required=False, widget=CheckboxSelectMultiple, choices=(('m', 'Male'), ('f', 'Female'))) }}} this generates in the view: {{{ u'<p>Gender: <ul>\n<li><label><input checked="checked" type="checkbox" name="gender" value="m" /> Male</label></li>\n<li><label><input type="checkbox" name="gender" value="f" /> Female</label></li>\n</ul></p>' }}} hope this helps! -- Ticket URL: <https://code.djangoproject.com/ticket/16308#comment:4> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.