2014-06-08 63 views
0

我有这个简单的形式..我在那里取了来自用户的输入像下面表单提交无效?

<form action="/data" autocomplete="on" method="POST"> 
    <input id="search" name="search" type="text" placeholder="Search for song or artists.."> 
<input id="search_submit" value="Submit" type="submit"> 
</form> 

,一切都工作正常..

现在..我想滑块添加到它,并发送滑块值为python。 我该怎么做?

我修改的形式是:

<form action="/data" autocomplete="on" method="POST"> 
    <input id="search" name="search" type="text" placeholder="Search for song or artists.."> 
    <input type="range" min="-1" max="1" value="0" step="0.05" onchange="showValue(this.value)" /><input id="search_submit" value="Submit" type="submit"> 
    <span id="range" style="color:#BDBDBD">0</span> 
</form> 

但它不工作,我得到

Bad Request 

The browser (or proxy) sent a request that this server could not understand. 

编辑

@app.route("/data", methods=['POST']) 
def entry_post(): 
    query = request.form["search"] 
    print request.form["range"] # I just added this line in the code 
+0

发布代码表单/数据。 – CyberJunkie

+0

@Cyber​​Junkie:请看看编辑 – Fraz

+1

我认为你错过了在你的html – eugecm

回答

1

你缺少 “name” 属性的范围输入字段。