Question

I am trying to move a database int value from my view page back to the controller. My view is a webpage that displays the names of my db.table_name as links:

            {{for i in session.query:   #session.query is db(db.person).select() (basically SELECT ALL)
            =A(LI(i.name),_href="personal.html",args=[i.id])
             pass}}

Now I get the results as links. When I click on a certain link I would like to save the id of that certain row for use in my controller. I understand that it has something to do with args in the views and request.args in the controller? What is the proper way to move values from view to contoller?

Was it helpful?

Solution

You probably want something like:

{{for i in session.query:}}
{{=LI(A(i.name, _href=URL('default', 'personal', args=[i.id])))}}
{{pass}}

And in the controller, access i.id via request.args(0).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top