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

317
Visualizações
Save check box values to firebase

In my form I have several checkboxes. All selected checkbox values should be written in firebase database. However, cannot manipulate the checkboxes. My code does not take the checkbox values. It does not appear on firebase. My form looks like this [![Form][1]][1] [1]: https://i.stack.imgur.com/8FEN4.png

HTML Code

 <td>
                            <label>
                                <input class="paint" id = "paint" value="Anti-Fungus Paint" type="checkbox" unchecked> Anti-Fungus Paint
                            </label>
                            <label>
                                <input class="paint" id = "paint" value="Emulsion Paint" type="checkbox" unchecked> Emulsion Paint
                            </label>
                            <label>
                                <input class="paint" id = "paint" value="Anti-Corrosive Paint" type="checkbox" unchecked> Anti-Corrosive Paint
                            </label>
                            <label>
                                <input class="paint" id = "paint" value="All in one Paint" type="checkbox" unchecked> All in one Paint
                            </label>
                        </td>

Javasript

document.getElementById('formBid').addEventListener('submit',function(e){
            e.preventDefault();
            var id=Date.now();  //generating a unqiue id
            set(ref(db,'quotes/' + id),{
               paint:document.querySelectorAll('input[id="paint"]:checked'),
              
            });
            alert('Quote Sent To Client');
            formBid.reset();
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

first, you should difference the id of each checkbox, the id should be unique to make it works. I usually use getElementById to get each value because it's easier for me.

about 4 years ago · Juan Pablo Isaza Relatório
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