On Mar 17, 4:55 pm, cyber <[email protected]> wrote: > Hi there! > > I need a hint of how to get variable value from view to my function in > controller. > > My code in controller: > *************************************************************************************************** > * def work(): > * row=db.executesql('SELECT * FROM autos WHERE autos.id=20') > * return dict(row=row) > *************************************************************************************************** > > My code in the view (new.html): > *************************************************************************************************** > * {{for r in records:}} > * {{=A(r.id,_href=URL('work', vars={'i':r.id}))}}
If you build the URL with vars it will look like this: (assuming r.id == 3) http://.../default/work?i=3 and the value of i will be available to your controller in request.vars.i # same key as in the vars dict inside URL() Now, if you use URL(..., args=[r.id] ) it will create a link like this: http=//.../default/work?3 and the value is available in request.args[0] > *************************************************************************************************** > > As you see I can select one row from db by id but I want work function > to get current id instead "autos.id=20" > I have no ideas of how to use variable from view in my controllers > def. > > So, any proposals!?! Please...

