title: flashing message in flask on a bootstrap modal
body: <p>I'm trying to follow the flask documentation. After a successful form submission (a signup form), I flash a message saying 'Signup successful'. However, I'm trying to have this message appear on a bootstrap modal.</p>
  
  <p>Simplified code is...</p>
  
  <pre><code>@app.route('/signup', methods=['GET','POST'])
  def signup():
      form = SignupForm()
      if form.validate_on_submit():
          flash('You were successfully signed up')
  return render_template('signup.html', form=form)
  </code></pre>
  
  <p>Now I only need to trigger the modal with the success flash message if form submission is successful. So I had my modal HTML snippet inside the flash message checks.</p>
  
  <pre><code>&lt;HTML code for forms&gt;
  &lt;input type='submit' value="Signup" data-toggle="modal" data-target="#myModal"&gt;
  {% with messages = get_flashed_messages() %}
  {% if messages %}
      &lt;ul class=flashes&gt;
      {% for message in messages %}
          &lt;div class="modal fade" id="myModal" role="dialog"&gt;
              &lt;div class="modal-dialog"&gt;
                  &lt;div class="modal-content"&gt;
                      &lt;div class="modal-body"&gt;
                          {{ message }}
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      {% endfor %}
      &lt;/ul&gt;
  {% endif %}
  {% endwith %}
  </code></pre>
  
  <p>This doesn't trigger the modal at all. Any thoughts on how I might get this to work?</p>