Highlighted

Combo box help

tobys96718113

12-09-2018

I am having an issue with a combo box on an Adobe form that after selecting the item and moving to another field the value changes to the top item in the combo box. the code is:

var contarr = new Array() ;

contarr[0] = ["Superintendent", "Super Phone"];

contarr[1] = ["Rene Zaragoza", "(916) 343-0086"]

contarr[2] = ["John Ruhga", "(916) 343-0012"]

contarr[3] = ["Dustin Miller", "(916) 343-0058"]

contarr[4] = ["Mike Sampang", "(775) 745-0156"]

var names = [];

for (var i = 0; i < contarr.length; i++) {

    names.push(contarr[i][0]);

}

  1. this.getField("Superintendent").setItems(names);
  2. this.getField("Superintendent").setAction("Blur", "onContactSwitch(event.value);");

function onContactSwitch(name) {

    for (var i = 0; i < contarr.length; i++) {

        if (contarr[i][0] == name) {

            selectContact(i);

            break;

        }

    }

}

function selectContact(i) {

    this.getField("Super Phone").value = contarr[i][1];

}

This code is in the Mouse UP trigger

thanks for your help!

Replies