Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
How to select sliders and save info of the input fields to commit on PostgrelSQL

So I have a page with the following: (1) Text field = Title, (2) Dropdown (3) Text Field = Description. Also on that page I have a table that is filled with the info on a PostgreSQL table and the query is done in a .py with Flask and SQLAlchemy. Every line of the table has a slider that the user can click. When the user click on the submit button all the info that was filled need to go to the corresponding tables in the DB and if there is any sliders with status == checked that info needs to go to the table of the DB as well. I was getting the text fields and dropdown using cookies and I did try to verify if the status of the sliders are checked but so far didn't work.

Any tips about how to do this work? Is there a better way to do this besides using cookies? Thanks in advance c; I'm using HTML, Bootstrap5, Javascript, Flask, SQLAlchemy and Jinja2

HTML
                {% for e in inves %}
                <tr>
                  <td>{{ e[0] }}</td>
                  <td>{{ e[1] }}</td>
                  <td>
                    <label class="switch">
                        <input type="checkbox" id = "checkbox_inves_{{loop.index}}">
                        <span class="slider round"></span>
                    </label>
                  </td>
                </tr>
                {% endfor %}
const switchs = document.querySelectorAll(".switch");
switchs.forEach(s => {

  s.querySelector("slider round").addEventListener("click", e => {

    if (e.checked){
      console.log("checked:" + e.target.id)
    }else{
      console.log("unchecked:" + e.target.id)
    }

  });
});
about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda