【发布时间】:2021-06-03 16:26:54
【问题描述】:
在表单下方的同一页面上显示搜索结果后,我希望搜索词仍然留在搜索框中,而不是被清除。我的搜索表单模板:
<form class="search" method="post">
<input name="query" type="text" style="max-width:700px" placeholder="Search over wbkg.." id="query" autocomplete="on" required>
<button type="submit"><i class="fa fa-search"></i></button>
<input type="radio" name="options" id="kmatch" value="kmatch" checked="checked">match </input>
<input type="radio" name="options" id="kextraction" value="kextraction"> extraction </input>
</form>
烧瓶视图函数:
@bp.route('/wbkg', methods=('GET', 'POST'))
def wbkg():
if request.method == 'POST':
query = request.form['query']
search_type = request.form['options']
results = search(query, search_type)
return render_template('nlp/wbkg.html', items=results)
return render_template('nlp/wbkg.html')
这可能吗?
【问题讨论】: