html的相关部分:
<h1>Create KML</h1>
<br>
<br>
<div class="demo">
<form action="" method="post">
<p id="basicExample">
<input type="text" placeholder="Start Date" class="date start" value="{{ request.form.datestart }}"/>
<input type="text" placeholder="Start Time" class="time start" value="{{ request.form.timestart }}"/> to
<input type="text" placeholder="End Time" class="time end" value="{{ request.form.timeend }}"/>
<input type="text" placeholder="End Date" class="date end" value="{{ request.form.dateend }}"/>
</p>
<p>
<button type="submit">Create</button>
</form>
Create KML file of points in selected time range. This file can be opened with Google Earth.
</p>
</div>
<!-- Script for date time picker -->
<script>
$('#basicExample .time').timepicker({
'showDuration': true,
'timeFormat': 'g:ia'
});
$('#basicExample .date').datepicker({
'format': 'm/d/yyyy',
'autoclose': true
});
$(document).ready(ready);
var basicExampleEl = document.getElementById('basicExample');
var datepair = new Datepair(basicExampleEl);
</script>
<!-- END Script for date time picker -->
出于某种原因,每当我用下面的日历和时间选择器包裹输入时,停止运行?
!!编辑以显示表单post方法标记的更改和位置。
此外,这是我的烧瓶路线:
@app.route('/create_kml',methods=['GET','POST'])
def create_kml():
if request.method == 'POST':
print request.form['date start']
return render_template('create_kml.html')
日期/时间选择器现在保留,但是当按下提交时,它会返回一个不良请求。