Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9230947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:56:46+00:00 2026-06-18T05:56:46+00:00

I have a Flask application, and in my html template (which is Jinja2) I

  • 0

I have a Flask application, and in my html template (which is Jinja2) I have a simple form which has only a button:

<form name='resetLayoutForm' method='POST'>
    <input type="submit" value="Reset layout" class="submitButton"/> 
</form>

Now, I want to know how can I ‘let the Python script know’ that the button was clicked?

I tried with:

@app.route('/localhost/some_route', methods = ['POST', 'GET'])
def function():
    .   .    .
    if request.method == 'POST':
        # code
    .   .    .

but this isn’t a good solution, because I have some other operations in the code that are using the POST request method, and I don’t want #code to be activated when I use these other POST operations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:56:47+00:00Added an answer on June 18, 2026 at 5:56 am

    Duplicate the form that contains the button and set it’s action to a different URL. Then, when pressed, only that different URL will receive the data.

    Obviously, as others have noted, there are Javascript mechanisms to achieve this but if those are not needed…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application which is deployed by the means of Flask. I'm
I have a footer template which has a input and submit for email subscription.
Imagine that I have a form in a flash application with two fields, input1
I only have very limited control over a flash application. The only thing I
Recently I have a task that should write an HTML application and run it
By default Flask uses template files stored in the "templates" directory: /flaskapp /application.py /templates
Recently I have made a simple flash application that utilizes a webcam feed and
I have simple RoR 3.2 application with Twitter bootstrap 2.1.0 (i implemented it via
My application uses a combination of Flask, Flask-SQLAlchemy, Flask-WTF and Jinja2. In its current
I have some html that is created/output from a flash application & I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.