On Wed, Apr 1, 2009 at 10:44 AM, Timothy <83...@gmx.de> wrote:

>
> Hi Folks,
>
> I have checkboxes in my Form - submitd with POST-method
>
> request.POST['stat'] delivers a list/a string(???)  [1, 2, 3 A, B] /
> "1, 2, 3, A, B"
>
> I try to evaluate this but get only the last value (here: "B")
>
> my code
>
> a)  if "stat" in request.POST:
>           st = request.POST['stat'] ----->   st = "B"  not "123AB" as
> I expect
>
> b) if "stat" in request.POST:
>          st = ""
>          for x in request.POST['stat]':
>                   st = st + x   ---------------------> same result
> "B" and not "123AB"
>
> How can I get the whole list/string to save it in my database?
>
> Thx
> Timothy
>
> >
>
Use request.POST.getlist('stat').  POST['var'] returns the first item while
getlist() return a list of them.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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