Monday, July 23, 2012

Re: Variable # of fields in a form

On 2012/07/20 01:37 PM, Daniel Roseman wrote:

> You don't want a variable number of fields, you just want a single
> MultipleChoiceField field using a CheckboxSelectMultiple widget.
>
> https://docs.djangoproject.com/en/1.4/ref/forms/fields/#multiplechoicefield
> https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#checkboxselectmultiple

Thank you Daniel. I have done this and see that it answers my question
(that HTML output is pretty ugly!). In Bootstrap I have used an
accordion so that the the categories are grouped:

Internal
x Evan
x Joe
External
x Alex

where x's are checkboxes and only one of Internal or External would be
expanded at any one time. Do you have a recommendation as to how break
up this CheckboxSelectMultiple widget into groups (also variable)?

I know I am digging my own grave...

--
Regards
Alex

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment