문제

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?

도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top