Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-14 Thread Martin Weissenboeck
Thank you for your additionals hints. This is the last version of my program, it does not use vars.records and it is very simple. def test1(): form = SQLFORM.grid(db.tt, selectable=test2, ) form.elements('table')[0].append(INPUT(_type='text', _name='f')) return dict(for

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-14 Thread Anthony
On Thursday, December 14, 2017 at 2:21:20 AM UTC-5, mweissen wrote: > > Hi Anthony! > > You have written: > > 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*

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Martin Weissenboeck
Hi Anthony! You have written: 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

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Anthony
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:

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Martin Weissenboeck
A very good idea - it works! Thank you and sorry that I did not find it myself. Am 13.12.2017 22:22 schrieb "Val K" : > > maybe this way?: > selectable=lambda ids: redirect(URL('test2', vars=dict(id=ids, f=request. > vars.f)) > > > > On Wednesday, December 13, 2017 at 11:15:03 PM UTC+3, mweissen

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Val K
maybe this way?: selectable=lambda ids: redirect(URL('test2', vars=dict(id=ids, f=request. vars.f)) On Wednesday, December 13, 2017 at 11:15:03 PM UTC+3, mweissen wrote: > > Anthony, now I have written a small program as example : > > def test1(): > if "f" in request.vars: > raise H

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Martin Weissenboeck
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'))

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Anthony
Hard to say without seeing your code, but after processing the selected records, the grid does a redirect, so you have to access request.vars.f before defining the grid. Anthony On Wednesday, December 13, 2017 at 5:13:52 AM UTC-5, mweissen wrote: > > Hi Anthony, > > thank you for your answer. O

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Martin Weissenboeck
Hi Anthony, thank you for your answer. Of course I have tried "request.vars.f" before asking my question: *request.vars.f* is None and does not work for me. My SQLFORM.grid has a selectable argument and therefore it creates an INPUT(_type="submit") button. After pressing this button the form call

[web2py] Re: Add INPUT to SQLFORM.grid

2017-12-12 Thread Anthony
request.vars.f On Tuesday, December 12, 2017 at 3:47:56 AM UTC-5, mweissen wrote: > > I want to add *one and only one *INPUT field to a grid (not one field per > row, but one filed for the whole grid) > > For example: > > form = SQLFORM.grid() > form.elements('table')[-1].append(INPUT(_type='