I am attempting to create multiple buttons for an SQLFORM.grid which, upon
being click, will have the effect of redirecting data selected in the
grid's checkboxes to other controller functions. The code is something like
the following:
def redirect_func(x):
if request.vars.action == 'action1':
redirect(URL('function1', vars=dict(x = x)))
elif request.vars.action == 'action2':
redirect(URL('function2', vars=dict(x = x)))
...
grid = SQLFORM.grid(...
selectable = lambda x: redirect_func(x)
...)
submission_form1 = FORM(INPUT(_type='hidden', _name='action', _value='action1'),
INPUT(_type = 'hidden', _name='_formkey',
_value= grid.element('form').formkey),
INPUT(_type = 'hidden', _name='_formname',
_value=grid.element('form').formname),
INPUT(_type='image', ...))
submission_form2 = FORM(INPUT(_type='hidden', _name='action', _value='action2'),
...)...
grid.insert(-1, DIV(submission_form1, submission_form2))
The redirect goes to the right function, but the value of "x" does not end
up getting passed to that function under request.vars.x, as expected. Any
advice on how to get the value of "x" to the appropriate function?
Otherwise, is there a better approach to accomplishing the same thing?
Thank you.
--
---
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/groups/opt_out.