I have a form around a table and in the table one of the columns has a checkbox for each row.
Item Amount Select
-------------------------
apple 10 [x]
banana 5 [ ]
orange 23 [ ]
I then have two buttons, one deletes the row, the other does something else in the backend with the same information.
<form action="{{ url_for('do_action') }}" method="post">
<table>
...content
<input name="check" type="checkbox">
</table
<button type='submit'>Delete Row</button>
<button type='submit'>Update</button>
</form>
Is there a way to attach some sort of context to the form depending on the button I press?
I want my route in the backend to know what to do
@app.route('/do_action', methods=['POST'])
def do_action():
if button.clicked == 'delete':
# do delete action
elif button.clicked == 'update':
# do update action
return 'Complete'