I have a single form accepting some data from the user. And I have 2 submit buttons on the same html template. I used validate_on_submit to identify a submit click. But, how do I identify, which button was clicked, so that I can perform 2 different options for the two different button clicks??
My view.py is as follows:
@app.route('/user', methods=["GET", "POST"])
def user():
form = ProjectSelect()
if form.validate_on_submit():
# How do we identify 2 different submits here?
return render_template('user.html',
form=form)
My user.html is as follows:
{% extends "base.html" %}
{% block content %}
<h1> Tool!</h1>
<h2>Select projects of interest</h2>
<table border="2"><form action="" method="POST">
{{form.hidden_tag()}}
====Get input here====
<tr>
<td>
<p> <input type="submit" value="Setup Alert!!">
</p>
<p> <input type="submit" value="Delete Alert!!">
</p>
</td>
</tr>
</table>
...
PLease let me know if it is possible to distinguish between the 2 submits.