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

160
Views
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
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!