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

421
Vistas
Dynamic Dropdown Menu using 'switch' Javascript Not Working

I have this script at the document level (simplified) on a PDF:

function SetFieldValues(){
var Model = this.getField("Model");
var Armor = this.getField("Armor");
var Winch = this.getField("Winch");
var Test1 = this.getField("Test1");
var Test2 = this.getField("Test2");

if(event.willCommit)    {
switch(event.value) {

case "015305676":
    Model.value = "AMK23";
    Armor.value = "YES";
    Winch.value = "NO";
    Test1.setItems[("Not Applicable")];
    Test2.setItems[("-", "Serviceable", "Unserviceable")];
    break;
}}}

This event is kicked off by the Custom Keystroke on the form's initiating dropdown list:

if( event.willCommit )
{
if(event.value == "-")
  this.resetForm(["Model","Armor","Winch"]);
else
  SetFieldValues(event.value)
}

All the fields update appropriately (Model, Armor, and Winch) however, the "Test" combo boxes do not populate as expected.

I then tried it a different way with this (which I thought would be genius using an array ...pfft... I was wrong):

function SetFieldValues(){
var Model = this.getField("Model");
var Armor = this.getField("Armor");
var Winch = this.getField("Winch");

const ArmorArray = [field='Test1', field='Test2'];
var ArmorArray;

var CheckOptionsY = {
  Yes: [["-"],["Serviceable"],["Unserviceable"]],
};
var CheckOptionsN = {
  No: [["Not Applicable"]],
};
if(event.willCommit)
{
switch(event.value) {

case "015305676":
    Model.value = "AMK23";
    Armor.value = "YES";
    Winch.value = "NO";
    ArmorArray.setItems[(CheckOptionsY)];
    break;
}}}

Again, the fields update no problem (Model, Armor, and Winch) but the "Test" fields do not update with the combo box list options. What did I do wrong? How can I get these "Test" combo boxes to load with the appropriate 'Yes' / 'No' options?

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