Smartgrid onupdate still works while set to None

30 views
Skip to first unread message

Pham Quang Dung

unread,
May 30, 2014, 7:59:01 PM5/30/14
to web...@googlegroups.com
Anybody enlighten me on while this form still updates the data? (I expected it was disabled to then use my own callback)
    form = SQLFORM.smartgrid(db.anyinfo,onupdate=None
                        ,constraints = dict(anyinfo = (tb.name[6:]=='level'))
                        ,user_signature=False
                        )

Also is there a way to convert all the way to POST form (I am confused as this was asserted in the manual, however it's GET while it reads args from URI not form vars, right?)

Anthony

unread,
May 31, 2014, 9:07:33 AM5/31/14
to web...@googlegroups.com
On Friday, May 30, 2014 7:59:01 PM UTC-4, Pham Quang Dung wrote:
Anybody enlighten me on while this form still updates the data? (I expected it was disabled to then use my own callback)
    form = SQLFORM.smartgrid(db.anyinfo,onupdate=None
                        ,constraints = dict(anyinfo = (tb.name[6:]=='level'))
                        ,user_signature=False
                        )

"onupdate" is an argument of SQLFORM.grid that SQLFORM.smartgid passes on. SQLFORM.grid then submits the "onupdate" callback as the "onsuccess" argument to SQLFORM.process for update forms. The "onsuccess" argument is simply a callback function that gets run after a form has been accepted (i.e., processed). There is no reason to set onupdate=None, as that will have no effect -- it does not turn off editing. If you want to turn off editing, set editable=False.
 
Also is there a way to convert all the way to POST form (I am confused as this was asserted in the manual, however it's GET while it reads args from URI not form vars, right?)

Not sure what you mean here. If you are using the grid functionality to create or update records in the grid, the associated forms are POSTed. The query string is only used when searching the grid.

Anthony

Massimo Di Pierro

unread,
May 31, 2014, 6:44:19 PM5/31/14
to web...@googlegroups.com
Be aware that "user_signature=False" is very dangerous. It mostly meant for debugging. It exposes your grid read and write without restrictions to anybody authorized to access the action.

Pham Quang Dung

unread,
Jun 17, 2014, 2:24:18 AM6/17/14
to web...@googlegroups.com
You are right Anthony, understood now.
Thanks Massimo for the warning as well.
Reply all
Reply to author
Forward
0 new messages