Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!