Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda