Visiting One SQLFORM.grid triggers another SQLFORM.grid -- bug?

32 views
Skip to first unread message

LoveWeb2py

unread,
Apr 22, 2015, 9:15:25 AM4/22/15
to web...@googlegroups.com
Hello,

I have somewhat of a weird error and I'm not sure how to fix it.

Let's say I have two controllers:

def controller1():
     grid1 = SQLFORM.grid(db.table1)
     return locals()

def controller2():
     grid2 = SQLFORM.grid(db.table2)
     return locals()

The user visits controller1 and click edit on the SQLFORM.grid, leaves the window idle

Next the user visits controller2 to get information to populate into controller1 by viewing an individual record in controller 2 from a different table in a separate browser

Finally the user goes back to controller1 and makes his updates. When he clicks submit he gets redirected to controller2 and none of his updates in controller1 happen.

Is this anything that can be fixed or is this normal behavior? I'm guessing it has something to do with the CSRF protection?


Niphlod

unread,
Apr 22, 2015, 9:57:04 AM4/22/15
to web...@googlegroups.com
use different formname(s) for each grid.

LoveWeb2py

unread,
Apr 22, 2015, 10:04:12 AM4/22/15
to web...@googlegroups.com
Thanks, Niphlod! Should I define that like this?

In SQLFORM.grid(db.table1, formname="table1)

or do it in the FORM which SQLFORM.grid links to

LoveWeb2py

unread,
Apr 22, 2015, 10:22:13 AM4/22/15
to web...@googlegroups.com
Setting formname in SQLFORM.grid(db.table1, formname='table1') did the trick!

Thanks again, Niphlod!
Reply all
Reply to author
Forward
0 new messages