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

162
Vistas
Show a specific data from jinja2 according to a checkbox is checked or not

I have a specific select that I would change the options according to with a checkbox that is either checked or not. This select is inside another Jinja2 loop, like below:

    {% for row in tbl_cli %}
...code before the specific header and checkbox ...
        <th width=29%   style="background-color: #DBCEA7;color:black;z-index: 100;">Destino<br><label sytle="display: inline-block;"><input type="checkbox" onClick="libera(this)" id="libera_check" /> Habilitar todas as agências </label>   </th>
        <tr>
        ... a lot of code ...
        <td>
            <select class="form-select" style="font-size: 10px; width: 90%" name="ger_escolhido" id="{{ row['ID_ROW_GRTE'] }}">
                <option value="" disabled selected>Selecione o gerente destino</option>
                
                {% if variable_to_check == 0   %} 
                    {% for ger in tbl_codger %} 
                        <option style="font-size: 10px;" name="{{ ger['CHAVE'] }}">{{ ger['CHAVE'] }}</option>
                    {% endfor %}
                {% else %}
                    {% for ger_ag_de in tbl_codger_AG_DE %}
                        <option style="font-size: 10px;" name="{{ ger_ag_de['CHAVE'] }}">{{ ger_ag_de['CHAVE'] }}</option>
                    {% endfor %}
                {% endif %}
                
            </select>
            
        </td>
        ... another chunck of code ...
    </tr>
    {% endfor %}

So far, I've created a variable called variable_to_check in the javascript, but the jinja2 does not seem to get the value of this variable:

variable_to_check == 0
function libera() {
    let check = document.getElementById('libera_check')

    
    if (check.checked) {

    var_libera_todas_agencias = 1
    
 
    
} else {
            
    var_libera_todas_agencias = 0
    
}


}
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