I tried adding
def transition_form():
for f, v in request.vars.iteritems():
db.users[f].default = v
form = SQLFORM(db.users)
response.vars = ''
if form.process().accepted:
response.flash = 'form accepted'
redirect(URL('users_list'))
elif form.errors:
response.flash = 'errors on page'
else:
response.flash = 'facepalm'
return dict(form=form)
but the same issue of 'Table' object has no attribute '_formkey' still
exist. I checked with firebug and the _formkey is under hidden values so it
is posting, but for some reason the page isn't picking it up...
On Monday, May 5, 2014 12:12:29 PM UTC-4, Richard wrote:
>
> You got 'facepalm' because it's not process the form when you get
> redirected... Since you don't redirect once the form get accepted and
> process web2py return the same function once the form validate and get
> process. Now maybe you should delete the request.vars once you have assign
> them as default value... An other issue maybe related to the fact that your
> vars names are the same of form.vars... I had issue with name collision in
> the pass deleting the request.vars after iteratio on it may help.
>
> Richard
>
>
> On Mon, May 5, 2014 at 11:57 AM, LoveWeb2py <[email protected]<javascript:>
> > wrote:
>
>> Controllers:
>> @auth.requires_login()
>> def users_list():
>> grid=SQLFROM.smartgrid(db.users, paginate=20, links_placement='left',
>> links=[dict(header='', body=lambda row: A(I(_class='icon retweet
>> icon-retweet'),
>>
>> _href=URL('transition_form', vars=dict((f, row[f]) for f in
>> db.users.fields))))], user_signature=True)
>> return dict(grid=grid)
>>
>> @auth.requires_login()
>>
>> def transition_form():
>> for f, v in request.vars.iteritems():
>> db.users[f].default = v
>> form = SQLFORM(db.users)
>>
>> if form.process().accepted:
>> response.flash = 'form accepted'
>> elif form.errors:
>> response.flash = 'errors on page'
>> else:
>> response.flash = 'facepalm'
>>
>> return dict(form=form)
>>
>> It populates the transition_form properly it just doesn't insert the new
>> record when I click submit. It just doubles the record and returns the
>> response in the view. Also, when loading the transition_form page it
>> automatically flashes with 'facepalm' which means its processing the form
>> on load.
>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.