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

215
Vistas
JavaScript for PDF button to set value for multiple dropdown lists

I'm creating form fillable pdfs that have a lot of drop down lists with the same options: X = OK, D = Defect, N = Not Applicable, and O = Repair Made. A lot of the time everything will be marked OK, so rather than selecting X in each drop down list, it would be great if clicking a button at the top would set the value for each drop down to X.

It would be great if it only marked empty drop downs as OK so if the user already filled out with something other than OK it doesn't overwrite it.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As far as I understand, you have a bunch of drop down lists with options X, D, N and O. You want a button which will set all unset drop downs to X when clicked.

Below is a "poorly written" code sample for that. You can use it as a starting point.

document.getElementById("okSetBtn").addEventListener("click", function(e) {
    document.querySelectorAll(".status").forEach(a => a.value = a.value || "X");
});
<button id="okSetBtn">Set unset to OK</button>
<div>
  <label>Status 1</label>
  <select class="status" id="status1">
    <option value=""></option>
    <option value="X">OK</option>
    <option value="D">Defect</option>
    <option value="N">Not Applicable</option>
    <option value="O">Repair Made</option>
  </select>
</div>
<div>
  <label>Status 2</label>
  <select class="status" id="status2">
    <option value=""></option>
    <option value="X">OK</option>
    <option value="D">Defect</option>
    <option value="N">Not Applicable</option>
    <option value="O">Repair Made</option>
  </select>
</div>
<div>
  <label>Status 3</label>
  <select class="status" id="status3">
    <option value=""></option>
    <option value="X">OK</option>
    <option value="D">Defect</option>
    <option value="N">Not Applicable</option>
    <option value="O">Repair Made</option>
  </select>
</div>

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