Reputation: 106
I'm not getting the value from my form submission in "request.vars" or "request.post_vars" like I thought I would get.
Here is my HTML for the form:
{{extend 'layout.html'}}
{{=message}}
<form id="LoginForm" name="FormLogin" action="{{URL()}}" method="post">
<div class="container">
<div class="row">
<div class="col-md-offset-5 col-md-3 col-sm-6">
<div class="form-login">
<h4>{{=T("Welcome")}}</h4>
<input type="text" id="UserName" class="form-control input-sm chat-input" placeholder="{{=T("username")}}" />
</br>
<input type="text" id="UserPassword" class="form-control input-sm chat-input" placeholder="{{=T("password")}}" />
</br>
<div class="wrapper">
<span class="group-btn">
<button type="submit" class="btn btn-primary btn-md">{{=T("login")}} <i class="fa fa-sign-in"></i></button>
</span>
<span class="group-btn" style="float:right;">
<a href="{{=URL("prov_login", "register")}}" class="btn btn-success btn-md">{{=T("Register")}}</a>
</span>
</div>
</div>
</div>
</div>
</div>
</form>
My controller looks like this:
def index():
if request.vars>0:
out_message = "Registration request received "
else:
out_message = "no post"
return dict(message=out_message)
What am I missing? Why am I not getting the input values?
Upvotes: 0
Views: 874
Reputation: 2498
View Code:
{{extend 'layout.html'}}
{{=message}}
<form>
<div class="container">
<div class="row">
<div class="col-md-offset-5 col-md-3 col-sm-6">
<div class="form-login">
<h4>{{=T("Welcome")}}</h4>
<input type="text" id="UserName" name="username" class="form-control input-sm chat-input" placeholder="{{=T("username")}}" />
</br>
<input type="text" id="UserPassword" name="password" class="form-control input-sm chat-input" placeholder="{{=T("password")}}" />
</br>
<div class="wrapper">
<span class="group-btn">
<button type="submit" class="btn btn-primary btn-md">{{=T("login")}} <i class="fa fa-sign-in"></i></button>
</span>
<span class="group-btn" style="float:right;">
<a href="{{=URL("prov_login", "register")}}" class="btn btn-success btn-md">{{=T("Register")}}</a>
</span>
</div>
</div>
</div>
</div>
</div>
</form>
Controller Code:
def index():
if request.vars>0:
#out_message = "Registration request received"
# you can write this then you see all vars return after form submission
out_message = request.vars
else:
out_message = "no post"
return dict(message=out_message)
Upvotes: 1