Reputation: 589
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?
Upvotes: 1
Views: 860
Reputation: 25536
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)
.
Upvotes: 2