title: flask-wtf form validation not working for my new app
body: <p>I've used flask before and I've had working form validation, but for some reason it's not working for my new app. Here is the basic code of the form. </p>
  
  <pre class="lang-py prettyprint-override"><code>from flask.ext.wtf import Form, TextField, TextAreaField, SubmitField, validators,ValidationError
  
  class subReddit(Form):
      subreddit = TextField('subreddit', [validators.Required('enter valid subreddit')])
      next = SubmitField('next')
      change = SubmitField('change')
      user = TextField('user', [validators.Required('enter valid user')])
      fetch = SubmitField('fetch comments')
  </code></pre>
  
  <p>I have subreddit as the validation field, so if it's empty, I want it to throw an error and reload the page. </p>
  
  <p>The HTML:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form class='sub' action="{{ url_for('sr') }}" method='post'&gt;
    {{ form.hidden_tag() }}                    
    &lt;p&gt;
      if you want to enter more than one subreddit, use the + symbol, like this:
      funny+pics+cringepics
    &lt;p&gt;
      &lt;br/&gt;
      {% for error in form.subreddit.errors %}
    &lt;p&gt;{{error}}&lt;/p&gt;
    {% endfor %}
    {{form.subreddit.label}}
    {{form.subreddit}}
    {{form.change}}                    
  &lt;/form&gt;
  </code></pre>
  
  <p>I have CSRF_ENABLED=True in my routes.py as well. What am I missing? When I leave the subredditfield empty and click change, it just reloads the page, no errors. This is an issue because whatever is in the field will get recorded in my database, and it can't be empty. </p>
  
  <p>EDIT</p>
  
  <pre><code>@app.route('/index',methods=['GET','POST'])
  @app.route('/',methods=['GET','POST'])
  def index():
  form = subReddit()     
  rand = random.randint(0,99)
  sr = g.db.execute('select sr from subreddit')       
  srr = sr.fetchone()[0]
  r = requests.get('http://www.reddit.com/r/{subreddit}.json?limit=100'.format(subreddit=srr))
  j = json.loads(r.content)     
  pic = j['data']['children'][rand]['data']['url'] 
  title = None
  if form.validate_on_submit():
      g.db.execute("UPDATE subreddit SET sr=(?)", [form.subreddit.data])          
      print 'validate ' 
      if j['data']['children'][rand]['data']['url']:   
          print 'pic real'                
          sr = g.db.execute('select sr from subreddit')       
          srr = sr.fetchone()[0]  
          r = requests.get('http://www.reddit.com/r/{subreddit}.json?limit=100'.format(subreddit=srr))
          pic = j['data']['children'][rand]['data']['url']
          title = str(j['data']['children'][rand]['data']['title']).decode('utf-8')   
          return render_template('index.html',form=form,srr=srr,pic=pic,title=title)
      else:
          print 'not valid pic'
          return render_template('index.html',form=form,srr=srr,pic=pic)
  else:
      print 'not valid submit'
      return render_template('index.html',form=form,srr=srr,pic=pic)           
  return render_template('index.html',form=form,srr=srr,pic=pic)
  </code></pre>