[web2py] Re: SQLFORM.smartgrid selectable return string or list

2019-04-21 Thread icodk
You both are righ: What's work now (also should worke before): selectable=[('change price 100', lambda ids: modify_price(ids,100) ), ] and the function in the same controller: def modify_price(ids,inc): print request.vars.records print ids print inc Both request.vars.records and ids are lists

[web2py] Re: SQLFORM.smartgrid selectable return string or list

2019-04-20 Thread Anthony
On Saturday, April 20, 2019 at 8:52:01 AM UTC-4, icodk wrote: > > Hi Antony > > My selectable looks like : > > selectable = [('Add 100 to price',lambda ids: redirect(URL('product', > 'modify_price', args=request.args, vars=dict(id=ids, inc=100, > > Why do a redirect rather than simply doing th

[web2py] Re: SQLFORM.smartgrid selectable return string or list

2019-04-20 Thread villas
Hi Icodk I would see exactly what is being submitted by the browser. Open the 'web developer' section in your browser and look at the 'network' traffic. When you click your submit button, see what variables etc are being sent. If your function is really being called, then try some print statem

[web2py] Re: SQLFORM.smartgrid selectable return string or list

2019-04-20 Thread icodk
Hi Antony My selectable looks like : selectable = [('Add 100 to price',lambda ids: redirect(URL('product', 'modify_price', args=request.args, vars=dict(id=ids, inc=100, and my function in the product controller looks like this: def modify_price(): if type(request.vars.id) is str:

[web2py] Re: SQLFORM.smartgrid selectable return string or list

2019-04-19 Thread Anthony
It should be request.vars.records, not request.vars.id. Note, request.vars is processed by the core framework, not by SQLFORM.smartgrid, so it will be a single value if the browser sends only one "records" field in the form data and a list otherwise. The core code that populates request.vars ha