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

147
Views
I want to be able to check multiple users, and only choose a single option per user AND send all selected users in a list per option in template/html

So, I couldn't get a simple title, sorry for that.

Basically, I want to send a message to X users.
For this I need to select the users that I want to send this message to, and their type, if they are normal, CC or CCI.
Every single type of option has a single name, meaning that in the end I get a list of normal recipients, of CC recipients and CCI recipients. All of this using check-boxes, needing me to create a javascript event to recreate a radio-type of behavior for the options of a single user. I was wondering if there was a better option than this, by using radios?

Here is how it's looking:
Screenshot of current appearance

CCI aren't implanted yet since I started to ask myself this question when I was asked to make them... Here is the code for one user, with the onclick event being the function that recreate radio behavior...

<label class="dropdown-item text-wrap labelname" style="overflow-wrap: break-word; padding-left: 5px; padding-right: 0px;">
    <input class="green form-check-input me-1  checkboxes-recipients recipientsmessage  " id="green2"  onclick="syncUnCheck(green2, gray2)"  type="checkbox" value="invite" name="recipients[]">
    <input class="gray form-check-input me-1  checkboxes-recipients recipientsmessage" id="gray2" onclick="syncUnCheck(gray2, green2)" type="checkbox" value="invite" name="recipientsCC[]">
    invité
</label>

The problem of this function is that It doesn't handle an indefinite amount of check boxes, but only 2 currently, and 3 in the future If I find no other options...perhaps an array argument instead?
here is the code of the function:

<script>
    function syncUnCheck(id, idAlt1) {
      $(id).on("change", function() {
        var ischecked= this.checked
        if (ischecked) {
            $(idAlt1).prop("checked", !this.checked).trigger('change');
        }
        {% if '/messagerie/send' in request.path %}
        showCheckedMessage();
        {% endif %}
      });
    };
</script>

The questions are thus:
Is there an easy html way to do what I want?
A Django trick allowing me to easly use radios with different names for each users?
Or should I just change the js function to handle an undetermined number of checkboxes instead?

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