how to pass value from view to controller in web2py

孤街浪徒 提交于 2019-12-02 09:29:16

web2py doesn't work quite like that. Before proceeding, I suggest you read some of the introductory documenation as well as the documentation on forms.

If you submit a form to a web2py URL, the function that handles that URL can access the form variables in request.vars (also, request.post_vars if submitted via POST and request.get_vars if submitted via GET). In the case of your code, you would need to add a "name" attribute with the value "lang" to the <select> element, in which case, the receiving action could access the value via request.vars.lang. You controller action itself should not take any arguments.

Instead, though, you might find it easier to use web2py's built in forms functionality as noted above.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!