Massimo, thanks for your correction, but I need code like that: ************************************** * def work(i): * * row=db(db.autos.id==i).select() * * return dict(row=row) * **************************************
In this case "i" is a variable from the view "default/new.html". The link is: "http://.../default/work?=3". Figure 3 is an example. In this code I want to use "i" as argument for "work()" but the result is "invalid function(default/work)". I hope my descriptions are clear for you :) How can I set the value of variable from the current view to my def in controller? Thank you in advance... _____________________________________________________________ On 18 мар, 00:03, Massimo Di Pierro <[email protected]> wrote: > My code in controller: > *************************************************************************** > ************************ > * def work(): > * row=db(db.autos.id==20).select() <---- can be done with DAL > * return dict(row=row) > *************************************************************************** > ************************ > My code in the view (new.html): > *************************************************************************** > ************************ > * {{for r in rows:}} <-- rows not records > * {{=A(r.id,_href=URL('work', vars={'i':r.id}))}} > * {{pass}} <--- missing > *************************************************************************** > ************************ > > Anyway, your select returns at most one record. > > On Mar 17, 3: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}))}} > > *************************************************************************** > > ************************ > > > 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...

