title: Using BooleanField to toggle hide html element with Javascript
body: <p>I am trying to implement a checkbox using Flask that toggles if another field is visible. If I do this in just HTML this works fine, but I am clearly not understanding something in Flask about this.</p>
  
  <p>My HTML and javascript is at the bottom of the page. </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  {% import "bootstrap/wtf.html" as wtf %}
  
  
  &lt;html lang="en" xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;  
      {% block content %}
          &lt;div class="page-header"&gt;
              &lt;h1&gt;Normal Change Request&lt;/h1&gt;
              &lt;h4&gt;Hello, Gavin White&lt;/h4&gt;
          &lt;/div&gt;
  
          &lt;form class="hide-test" method="post" role="form"&gt;
              &lt;div id="core-dte"&gt;
                  {{form.coreDate.label}}
                  {{form.coreDate}}
              &lt;/div&gt;
              &lt;div id="hiding-dte" style="display:block"&gt;
                  {{form.hideDate.label}}
                  {{form.hideDate}}   
              &lt;/div&gt;
              &lt;div id="chk-button"&gt;{{form.hide.label}}&lt;/div&gt;
              &lt;div id="chkHide" onclick='myFunction("chkHide", "hiding-dte")'&gt;{{form.hide}}&lt;/div&gt;
              &lt;div&gt;
                  {{form.submit}}
              &lt;/div&gt;
          &lt;/form&gt;
      {% endblock %}
  
      &lt;script&gt;
          function myFunction(chk, txt) {
              var checkBox = document.getElementById(chk);
              var text = document.getElementById(txt);
              if (checkBox.checked == true){
                  text.style.display = "block";
              } else {
                 text.style.display = "none";
              }
          }
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Python: </p>
  
  <pre><code>class BaseForm(FlaskForm):
      '''
      '''
      coreDate = DateField('Date:')
      hideDate = DateField('Hide Date:')
      hide = BooleanField('Hide')
      submit = SubmitField('Submit')
  
  @app.route('/')
  def index():
      '''
      '''
  
      baseForm = BaseForm()
      if baseForm.validate_on_submit():
          core_date = baseForm.coreDate.data
          hide_date = baseform.hideDate.data
          hide = baseForm.hide.data
  
          return '&lt;h1&gt;Success&lt;\h1&gt;'
  
      else:
          return render_template('hide-test.html', form=baseForm)
  </code></pre>
  
  <p>I have googled and tried a few implementations, but now at the pint where I am rady to pull my hair out and need some help. If there is a way to use python to do this and not javascript that would be great, but just want to get this to work more than anything.</p>