Answers for "flask + python + on click of a button without using form"

5

button in flask

<input type="submit" name="submit_button" value="Do Something">
<input type="submit" name="submit_button" value="Do Something Else">
def contact():
    if request.method == 'POST':
        if request.form['submit_button'] == 'Do Something':
            pass # do something
        elif request.form['submit_button'] == 'Do Something Else':
            pass # do something else
        else:
            pass # unknown
    elif request.method == 'GET':
        return render_template('contact.html', form=form)
Posted by: Guest on May-15-2020

Code answers related to "flask + python + on click of a button without using form"

Python Answers by Framework

Browse Popular Code Answers by Language