문제

I'm trying to get value from user using form and send the value to another controller to do some operation on it

Simple Example : how to send x from (default/index.html) to (output/index.html) or how to call the function (output/index) in (default/index.html)

default.py 
index(): 
return dict()

index.html 
{{extend 'layout.html'}} 
<form enctype="multipart/form-data" action="{{=URL()}}" method="post">
 Your name: <input name="name" /> <input type="submit" /> 
</form> 
{{x=request.vars.name}} 

output.py 
index(x): 
return x
도움이 되었습니까?

해결책

Just post the form to the URL that you want to handle the data:

<form enctype="multipart/form-data" action="{{=URL('output', 'index')}}" method="post">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top