Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Why won't my drop down list populate from the array?

Avatar

Level 2

I am using the following array. 

var actDesc = new Array(" ",

"Desc1 ",

"Desc2 ",

"Desc3 ");

// Array of HUD Activity Numbers.

var actNum = new Array(null,

"1 ",

"2 ",

"3 ");

// This populates the Description Drop-down List and works just fine.

function populateActDesc(dropdownField)

{

      var i;

      for (i=0; i < actDesc.length; i++)

         dropdownField.addItem(actDesc[i]);

}

//This is supposed to populate the Description Number Drop-down List but doesn't work.

function populateActNum(dropdownField)

{

      var i;

      for (i=0; i < actNum.length; i++)

         dropdownField.addItem(actNum[i]);

}

// Populates another field based on the Description Field value chosen and works as intended.

function getDesc(hudActivityDescription, hudActivityNumberField)

{

   var i;

   for (i = 0; i < actDesc.length; i++)                

   {

      if (actDesc[i] == hudActivityDescription)        

  {

        hudActivityNumberField.rawValue = actNum[i];        

   break;               

  }

   }

}

I placed the following into the drop-down list object holding the actDesc array (Event: initialize; Language: javascript):

actNoScript.populateActDesc(this);

This works just fine.

I placed the following into the drop-down list object holding the actNum array (Event: initialize; Language: javascript):

actNoScript.populateActNum(this);

This doesn't work.  Any ideas?

Any help would be greatly appreciated.  I am using LCD 8.2 ES on Vista 32bit.

Thanks,

Jerald

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Jerald,

You can't assign null to the display value of a drop down control.  If you change the HUD activity number array to remove the null it should work. 

That is;

// Array of HUD Activity Numbers.

var actNum = new Array("  ","1 ","2 ","3 ");

Bruce

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi Jerald,

You can't assign null to the display value of a drop down control.  If you change the HUD activity number array to remove the null it should work. 

That is;

// Array of HUD Activity Numbers.

var actNum = new Array("  ","1 ","2 ","3 ");

Bruce