0
我有一個頁面呈現用戶搜索的數據。我希望允許用戶隨時在頁面一側更改搜索憑據。出於某種原因,它只是爲「更換學校」部分工作。爲什麼代碼永遠不會到達其他搜索字段(例如,當我更改搜索類型時,沒有任何反應,沒有任何內容顯示到控制檯)。請忽略縮進錯誤,它在粘貼時變得混亂!處理更新的搜索表單
相關HTML:(所有名稱/ ID的文本字段匹配在肯定的Python代碼)
<form id="update" name="update" method="post" action="/find-it/">
<input type="submit" value="search" id="enter" form="update">
PYTHON:
if request.method == 'POST':
if "updateSchool" in request.form:
print('school changed')
school = request.form['updateSchool']
data = updateSchool(school)
return render_template('testBrowse.html', data=data)
elif "updateType" in request.form:
print('type changed')
newType = request.form['updateType']
data = updateType(newType)
print('getting to update type')
return render_template('testBrowse.html', data=data)
elif "updateTitle" in request.form:
print('title changed')
newTitle request.form['updateTitle']
data = updateTitle(newTitle)
return render_template('testBrowse.html', data=data)
return render_template('testBrowse.html', data=data)
非常感謝! – user3344239