Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Following the Purchase Order sample

Avatar

Level 7

and I'm stuck on this line of script:

partNoScript.populatePartNo(

this);

What does PartNo refer to?

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

Yes.

'populatePartNo'  is the function name. 'partNo' is the array name. Since 'partNo' is defined outside of a function it is available to all functions in the script object. The 'populatePartNo' function iterates over the 'partNo' array adding each child to the drop-down.

Steve

View solution in original post

0 Replies

Avatar

Level 10
populatePartNo is a function in the script object PartNoScript.
    
// Populate the part number Drop-down List.
function populatePartNo(dropdownField)
{
      var i;
      for (i=0; i < partNo.length; i++)
         dropdownField.addItem(partNo[i]);
}
    
Steve

Avatar

Level 7

Thank you. What does the specific phrase PartNo refer to. The dropdownfield is named txtPartNum and the var in the script is called partNo. The capitalization is throwing me, I guess.

Thanks,

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Level 10

PartNo is an array defined in the PartNoScript script object. It contains the values that are loaded into the drop-down.

// Array of part numbers.

var partNo = new Array(" ",

   "580463116",

   "25906311C",

   "25129637J",

   "771128",

   "11198262A",

   "57251",

   "25906312A",

   "51615223D",

   "51615224D",

   "516154CAC");

Avatar

Level 7

So it's OK that in the populate function the phrase is capitalized as PartNo although the var is partNo?

Thanks,

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Correct answer by
Level 10

Yes.

'populatePartNo'  is the function name. 'partNo' is the array name. Since 'partNo' is defined outside of a function it is available to all functions in the script object. The 'populatePartNo' function iterates over the 'partNo' array adding each child to the drop-down.

Steve

Avatar

Level 7

Thanks.

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065