title: python flask wtf form return value from function
body: <p>Trying to retrieve an int from a function which get the data from a form in wtform in Flask. </p>
  
  <p>form.py</p>
  
  <pre><code>    class CoilsSlittingMetric(FlaskForm):
      masterCoil = IntegerField('Master Coil Size [mm]', validators=[DataRequired()])
      slitOne = IntegerField('First Coil Size [mm]', validators=[DataRequired()])
      slitTwo = IntegerField('Second Coil Size [mm]', validators=[DataRequired()])
      slitThree = IntegerField('Third Coil Size [mm]', validators=[DataRequired()])
      slitFour = IntegerField('Fourth Coil Size [mm]', validators=[DataRequired()])
      remember = BooleanField('Remember my current entries?')
      submit = SubmitField('Calculate!')
  
  </code></pre>
  
  <p>when I run the routes.py without the return a statement it shows the flash message just fine
  but when I try to return the (myproblem) integer it returns the following error</p>
  
  <blockquote>
    <blockquote>
      <p>TypeError: The view function did not return a valid response. The return type must be a string, dict, tuple,</p>
    </blockquote>
  </blockquote>
  
  <p>here is the function </p>
  
  <pre><code>@app.route('/slitter', methods=['GET', 'POST'])
  @login_required
  def slitter():
  
      form = CoilsSlittingMetric()
      if form.validate_on_submit():
          myproblem = form.masterCoil.data
          flash(myproblem)
          flash(f'Calculating  {form.masterCoil.data} '
                f'and resulting data {form.slitOne.data}, {form.slitTwo.data}, '
                f'{form.slitThree.data}, {form.slitFour.data}')
          return myproblem
          return redirect(url_for('slitter_results'))
      return render_template('slitter.html', title="Slitter Calculator - Metric Sizes", form=form)
  </code></pre>
  
  <p>I sort of understand what is says in the error message but I need to use the integers of each of the values (testing just with one of them to simplify) but I don't know how to do it.</p>
  
  <p>I tried to search for similar issues in here but did find only one solution which did not work for me. </p>
  
  <p>EDIT:
  I try to use this value(s) later in another function </p>
  
  <pre><code>@app.route('/slitter_results', methods=['GET', 'POST'])
  @login_required
  
      myproblem = slitter()
      flash(myproblem)
  </code></pre>