I got a strange problem.

I specify a ChoiceField as SelectMultiple widget but got problem in
validation.

Can django ChoiceFIeld support valid with a List ? or how can I do
it ?

The source code is following:

# Source code of forms.py:

COMPONENTS_CHOICE = []
for component in get_components():
    COMPONENTS_CHOICE.append((component.id, component.name))

class CaseForm(forms.Form):
    # ...
    components_ids = forms.ChoiceField(label="Components",
widget=forms.SelectMultiple, choices=COMPONENTS_CHOICE,
required=False)

# Source code of view.py:

create_case_form = CaseForm(request.POST)

    if create_case_form.is_valid():
        # ...
    else:
        return HttpResponse(create_case_form.errors)

# Response Page:
* components_ids
-- Select a valid choice. [u'23507'] is not one of the available
choices.
--~--~---------~--~----~------------~-------~--~----~
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