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

249
Views
how to make multiple select checkbox with ajax and no button submit

Python 3.9 Django 3.2 I have categories and product , and through a simple form in the template I choose 1 or 2-3 checkboxes and I get the result. How to do it now via ajax and without button 'submit'.

I select several product categories and each click on the checkbox is ajax and the next click on the checkbox adds the parameter to the request.

it is similar to how you select several parameters in online stores. You have selected 2 parameters and received a filtered list of products

I suppose that you need to intercept the sending, store one request in the cache and add a new one to this request

              <form  method="post" id="category-box">
                {% csrf_token %}
                <div class="form-check">
                  <input class="form-check-input" type="checkbox" name='category' value="{{c.name}}" >
                  <label class="form-check-label" for="{{c.name}}"><a href="{{ c.get_absolute_url }}">{{ c.name }}</a></label>
                </div>
                {% endfor %}
                <button type="submit">Submit</button>
              </form>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can have an onChange on the form element which triggers when any input within the form has been changed. When the form changes, you send AJAX request with updated params and load new data.

This might be hurtful for performance though, clicking multiple checkboxes in short period of time would trigger a request for each click which is unnecessary. That can be handled with a slight delay before sending the request and a check if the form has changed subsequently.

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!