When you say you are using request.vars.id, do you mean you have an "id" 
variable in the query string, as in /myform?id=1?

If so, change the name of that variable to something else, as the edit form 
will include its own hidden field with the name "id" -- so upon submission, 
there will be a request.post_vars.id and a request.get_vars.id, both of 
which will end up in a list in request.vars.id.

More generally, to be safe, it's a good idea to use request.post_vars and 
request.get_vars specifically when you are dealing with requests that are 
likely to have both.

Anthony

On Monday, April 21, 2014 11:38:21 AM UTC-4, Sharon Correll wrote:

> I changed it to look very similar to this:
>
>
>> def myform():
>>     record = db.langResource(request.args(0))
>>     form = SQLFORM(db.langResource, record=record).process(
>>         message_onsuccess='Resource modified' if record else 'New 
>> resource added')
>>     return dict(form=form)
>>
>>>
> except that I get the id variable using "request.vars.id", and I include 
> the id variable in the dictionary:
>
>     idToEdit = request.vars.id
>     recToEdit = db.langResource(idToEdit)
>     form = SQLFORM(db.langResource, record=recToEdit).process(
>         message_onsuccess='Resource modified' if recToEdit else 'New 
> resource added')
>     return dict(sqlForm=form, idToEdit=idToEdit)
>
> Now when I submit the form, the second time the id variable becomes a 
> list! So if originally the id was 6, after I press Submit it is ['6', '6'] 
> (two strings). This was not happening before. And not surprisingly, 
> submitting the form has no effect at all. Why???
>
> It makes sense to be sure to just call the process() function once, but 
> when I reorganized my original code that way, I'm still getting the 
> original behavior (a new record is created and the old one is not modified).
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to