title: Multiple buttons on a flask webapp?
body: <p>I'm making my first webapp using python and flask, it is a simple calculator but I'm currently stuck trying to use more than one button. At the beginning it was abe just to show a graph, here is the python code:</p>
  
  <pre><code>class FormulaForm(Form):
      formula = StringField('formula')
      graph = SubmitField('graph')
  
  @app.route('/')
  def calculate():
      form = FormulaForm()
      formula = request.args.get('formula','')
      points = mp.make_points(formula,0,7)
      comp = make_plot(points[0],points[1])
      return render_template('index.html',the_script=comp[0],the_div=comp[1],form=form)
  </code></pre>
  
  <p>And here is the html code:</p>
  
  <pre><code>&lt;form method="GET" action=""&gt;
      &lt;br /&gt;
          {{ form.formula }}
      &lt;br /&gt;
          {{ form.graph }}
  &lt;/form&gt;
  </code></pre>
  
  <p>So far so good. But I don't know how to add more functionality, for example I would like to add a button that shows the formula evaluated at some value x. I tried adding an extra inputfield and an extra button in the form, something like this:</p>
  
  <pre><code>class FormFormula(Form):
      formula = StringField('formula')
      graph = SubmitField('graph')
      evaluate = StringField('evaluate_at')
      evaluate = SubmitField('evaluate')
  </code></pre>
  
  <p>But then I don't know how to make the view handle two different actions.
  I think I found a solution <a href="https://stackoverflow.com/questions/18290142/multiple-forms-in-a-single-page-using-flask-and-wtforms">here</a> but it only works when the method is "POST" and that makes the page reload which I don't want. So, is there a way to use multiple buttons in the same view? </p>