Expand my Community achievements bar.

Using "case" to poplulate multiple dropdowns

Avatar

Level 3

I'm using a case script to populate a dropdown

switch

(this.formattedValue) // use the current bound value of the dropdown

{

case "NW1 - Arlington WA":

OSRlumber.addItem("Gary");

OSRlumber.addItem("Miker");

OSRlumber.addItem("James");

OSRlumber.addItem("Joel");

}

// end of switch statement

All works well...however now I find that I need to populate five other separate and independant dropdowns with exactly the same list of names....

those list are

OsrLumber (current list)

OsrKitchens

OsrComponents

+ a few more

Can I use a wildcard in someway at the end of Osr to populate any pulldown with that prefix so I can populate all with one wildcard field name?

Thanks-pc

4 Replies

Avatar

Level 10

Hi,

If you name the dropdowns Osr1, Osr2, etc. then you could set up a loop. Let's say there were five dropdowns, then I would use this in the exit event of the object controlling the dropdown. Note I would also be inclined to include a clearItems() and .rawValue.

switch (this.formattedValue)

{

     case "NW1 - Arlington WA":

          for (var i=1; i<=5; i++)

          {

               var DD = xfa.resolveNode("form1.Osr" + i);

               DD.rawValue = null;

               DD.clearItems();

               DD.addItem("Gary");

               DD.addItem("Miker");

               DD.addItem("James");

               DD.addItem("Joel");

          }

     break;

}

There is an example here: http://assure.ly/gv7Gyk, where on page 2 the script in the mouseEnter event of the thumbnails uses an xfa.resolveNode.

Hope that helps,

Niall

Avatar

Level 3

Hmmm - not working....can you review and see what I'm missing

form1.Page1.Location::exit - (JavaScript, client)

switch

(this.formattedValue) // use the current bound value of the dropdown

{

case "NW1 - Arlington WA":

for (var i=1; i<=7; i++)

{

var DD = xfa.resolveNode("form1.Osr" + i);//I tried just form1.Osr too but that didn't work

DD.rawValue

= null;

DD.clearItems();

DD.addItem.addItem("Gary Gray");

DD.addItem.addItem("Mike Davis");

DD.addItem.addItem("James Schiessl");

DD.addItem.addItem("Joel Schalo");

DD.addItem.addItem("Todd Olson");

DD.addItem.addItem("Ken Canady");

DD.addItem.addItem("Tony Adams");

}

break;

} // end of switch statement

Noname.jpg

http://share.planswift.com/download/?file=CICAA03H-D7QC-LCCC-AFGS-RPPCFQZW9P3

Thanks! -pc   

Avatar

Level 3

Duh - had "adItem" in twice....answered my own question....

Avatar

Level 10

Hi,

Also in your form you do not need the "form1" in the resolveNode.

Here is a working example: https://acrobat.com/#d=Q3s1umNLGCkV0nPZBqavKg

Good luck,

Niall