vendredi 15 novembre 2019

keep checkboxes checked when Page reloads

For my search-engine I designed a filter using a form with checkboxes. When submitting those, the filter function works fine (using Flask for this). Yet the checkboxes which where used as a filter are unchecked again when the results are shown. Do I need to save the information in the localStorage, and how can this be done? Thanks for your help <3

This is a part of my Code for the checkbox (I am a newbie to HTML/JS):

 <form>                  
  <article class="card-group-item">                      
    <header class="card-header">                          
      <span class="title">Document Types </span>               
    </header>                     
      <div class="filter-content">
          <div class="card-body">
             <label class="form-check" >
                 <input class="form-check-input" type="checkbox" name="doctype" value="offer" id="offer">
                 <span class="form-check-label">Offer</span>
             </label> <!-- form-check.// -->
             <button type="submit" class="btn btn-secondary btn-sm">Submit</button>
          </div> <!-- card-body.// -->
      </div>
   </article> <!-- card-group-item.// -->
 </form>



Aucun commentaire:

Enregistrer un commentaire