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

321
Views
¿Hay alguna manera de deshabilitar un botón en Flask?

Soy nuevo en Flask y deshabilitaría un botón según la condición. En particular, tengo una página con 5 cuadros de selección y me gustaría habilitar el botón si se selecciona un valor para uno de ellos.

Este es mi código HTML:

 <form class="form-text" method="POST"> <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='styles/sections.css') }}"> <script src="{{url_for('static', filename='js/sections.js')}}"></script> <div class="row"> <div class="col-md-6"> <div class="row"> <div class="col-12"> <label>Section 1:</label> <select onselect="validate()" id="section-one" name="select_section" style="width:200px; margin-left: 30px;"> <option value="select-option"> &#45;&#45; select an option &#45;&#45; </option> {% for each in dropdown_list %} <option value="{{each}}">{{each}}</option> {% endfor %} </select> </div> </div> <div class="row"> <div class="col-12"> <label>Section 2:</label> <select name="select_section" style="width:200px; margin-left: 30px;"> <option disabled selected value> &#45;&#45; select an option &#45;&#45; </option> {% for each in dropdown_list2 %} <option value="{{each}}">{{each}}</option> {% endfor %} </select> </div> </div> </div> </div> <button id="select-button" type="submit" class="btn btn-primary">Select</button> ... </form>

Este es mi código JS:

 function validate() { var ddl = document.getElementById("section-one"); var selectedValue = ddl.options[ddl.selectedIndex].value; var myBtn = document.getElementById("select-button"); if (selectedValue == "select-option") { document.getElementById("select-button").disabled = true; } else { document.getElementById("select-button").disabled = false; } }

En mi código JS probé solo para la primera selección. ¿Qué ocurre? Gracias de antemano.

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!