On Wednesday, December 13, 2017 at 3:15:03 PM UTC-5, mweissen wrote: > > Anthony, now I have written a small program as example : > > def test1(): > if "f" in request.vars: > raise HTTP(401, "f=%s" % str(request.vars.f)) > form = SQLFORM.grid(db.tt, > selectable=lambda ids: None, > ) > form.elements('table')[0].append(INPUT(_type='text', _name='f')) > return dict(form=form) > > > You are right - request.vars.f contains the value. But only if I do not > use the "selectable" values. >
Not sure what you mean. When I try it, I get the expected list of record IDs in request.vars.records as well as the value of "f" in request.vars.f. The list in request.vars.records is ultimately passed to the "selectable" function, after which, the redirect happens. Can you explain exactly what you are doing, what you expect, and what you see instead? > > Now I change this program (like the example in chapter SQLFORM.grid in the > book): > > def test1(): > form = SQLFORM.grid(db.tt, > selectable=lambda ids: redirect(URL('test2', vars=dict(id=ids))) > ) > form.elements('table')[0].append(INPUT(_type='text', _name='f')) > return dict(form=form) > > def test2(): > return dict(form=request.vars) > > > test2 shows the ids of the selected rows. But now the value of *f *is not > accessable. > > What can I do to get both? > Well, you could always do: redirect(URL('test2', vars=dict(id=ids, f=request.vars.f))) but I don't see why that second approach is necessary. Anthony -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.