Cheers,

After a lot of trial-and-error and some source reading, an answer to
my own post:
In order to use a CheckboxSelectMultipleField as a SelectMultipleField
you must prepare the data before :-)

That means:
    if request.POST:
        new_data = request.POST.copy()
        errors = manipulator.get_validation_errors(new_data)
        if not errors:
            # ADD THIS LINE
            manipulator.prepare(new_data)
            manipulator.do_html2python(new_data)
            new_data.getlist('groups')

Hope it helps other people.

G

On 9/4/06, Guillermo Fernandez Castellanos
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I read in the documentation that CheckboxSelectMultipleField has an
> identical interface to SelectMultipleField. But this does not seem to
> work for me.
>
> I define a Manipulator with SelectMultiple field:
> forms.SelectMultipleField(field_name="groups", choices=(('My Test
> 1','My Test 1'),('My Test 2','My Test 2')))
> and in my view i access the information provided by my form:
>     if request.POST:
>         new_data = request.POST.copy()
>         manipulator.do_html2python(new_data)
>         errors = manipulator.get_validation_errors(new_data)
>         if not errors:
>         new_data.getlist('groups')
>
> This works just perfect. I obtain a list with all my choices.
>
> But if I use this instead:
> forms.CheckboxSelectMultipleField(field_name="groups", choices=(('My
> Test 1','My Test 1'),('My Test 2','My Test 2')))
>
> then I do not obtain anything when I do my new_data.getlist('groups').
>
> What am I doing wrong?
> Did I misunderstood the documentation?
>
> Thanks,
>
> G
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to