Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

433
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda