Yes. Note, web2py stores GET variables in request.get_vars and POST 
variables in request.post_vars. It stores both GET and POST vars in 
request.vars. If both get_vars and post_vars have variables with the same 
name, it puts their values in a list within request.vars. Just change your 
code to use request.get_vars.id instead of request.vars.id.

Anthony

On Wednesday, August 22, 2012 10:14:12 AM UTC-4, Massimo Di Pierro wrote:
>
> You have two id fields. One in request.get_vars.id (from the url) and one 
> in request.post_vars.id (from the form submission).
>
>
>
> On Wednesday, 22 August 2012 08:51:38 UTC-5, Christian Espinoza wrote:
>>
>> When I submit the form, on request.vars.id exist this value: ['2', '2']
>>
>> this is the problem, but I dont know why, Im sending the var from the 
>> controller to it self with the 2  value only..
>>
>> 'id' is a reserved function??
>>
>> Christian.
>>
>> 2012/8/21 Anthony <[email protected]>
>>
>>> How is request.vars.id being set -- in the query string? What is its 
>>> value when the form is created, and what is the value when submitted?
>>>
>>> On Tuesday, August 21, 2012 7:16:18 PM UTC-4, Christian Espinoza wrote:
>>>>
>>>> Hi Anthony,  I was try with .select().first(), but I get a error in the 
>>>> same way...
>>>>
>>>> The Error appears after I submit the form with the changes over the 
>>>> field, the form for a id user works, the problem is when I submit it.
>>>>
>>>> Thanks.
>>>> Christian
>>>>
>>>> 2012/8/21 Anthony <[email protected]>
>>>>
>>>>> Also, note the .select().first() returns the first row or None if 
>>>>> there are no results, so you don't have to test whether there are any 
>>>>> records before selecting the first row.
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Tuesday, August 21, 2012 6:58:47 PM UTC-4, rochacbruno wrote:
>>>>>>
>>>>>> You are getting an empty rows object
>>>>>>
>>>>>>
>>>>>> def change_membership():
>>>>>>
>>>>>>     if request.vars.id:
>>>>>>
>>>>>>         row = db(db.auth_membership.us****er_id == request.vars.id).
>>>>>> sele****ct()
>>>>>>         if not row:
>>>>>>             redirect(.........)
>>>>>>         id = row[0].id  
>>>>>>         form = SQLFORM(db.auth_membership,
>>>>>>                                    id,
>>>>>>                                    fields=['group_id'],
>>>>>>                                    _action=URL()
>>>>>>                                    )
>>>>>>     if form.process().accepted:
>>>>>>         ...redirect back to user list
>>>>>>
>>>>>>     if form.errors:
>>>>>>         response.flash = 'form has errors'
>>>>>>     
>>>>>>     return dict(form=form)
>>>>>>
>>>>>> also can be done with
>>>>>>
>>>>>>  row = db(db.auth_membership.u****ser_id == request.vars.id).sel****
>>>>>> ect() or redirect(.....)
>>>>>>
>>>>>>
>>>>>>
>>>>>> *Bruno Cezar Rocha** - @rochacbruno*
>>>>>> [email protected] | Mobile: +55 (11) 99210-8821
>>>>>> www.CursoDePython.com.br | www.rochacbruno.com.br
>>>>>> Blog: WEB APPS THAT WORTH A 
>>>>>> TRY<http://rochacbruno.com.br/web-apps-that-worth-a-try/>
>>>>>>   Get a signature like this. 
>>>>>> <http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>
>>>>>>  Click 
>>>>>> here.<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>
>>>>>>    
>>>>>>
>>>>>>
>>>>>>  -- 
>>>>>  
>>>>>  
>>>>>  
>>>>>
>>>>
>>>>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>

-- 



Reply via email to