Expand my Community achievements bar.

SOLVED

Make objects display and rawValues match

Avatar

Level 9

I have a drop-down field that is populated based on which radio button is selected. The list is populated using Javascript like this:

if (condition)

this.additem("4 Hours", "4")

this.additem("8 Hours", "8")

if (condition)

this.additem("5 Hours", "5")

this.additem("10 Hours", "10")

I am trying to make another drop-down match the contents of this one when the first one is exited. I can't use:

FirstListField = this.rawValue

because I want it to display (for example) 4 Hours and have the corresponding rawValue of 4

How do I capture the (displayed) value and rawValue?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Don,

If you users all have Reader 8.0 or later then you can use the following JavaScript code in the preOpen event of the second dropdown.

this.rawValue == null;

this.clearItems();

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

{

    this.addItem(DropDownList1.getDisplayItem(i), DropDownList1.getSaveItem(i));

}

Regards

Bruce

View solution in original post

3 Replies

Avatar

Level 9

Okay - no replies. Maybe I did a poor job explaining what I am trying to do. I have attached an example form with a short note describing which drop-down needs to match the original and when. Please help!

Example Form

Thanks!

-Don

Avatar

Correct answer by
Level 10

Hi Don,

If you users all have Reader 8.0 or later then you can use the following JavaScript code in the preOpen event of the second dropdown.

this.rawValue == null;

this.clearItems();

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

{

    this.addItem(DropDownList1.getDisplayItem(i), DropDownList1.getSaveItem(i));

}

Regards

Bruce

Avatar

Level 9

Bruce,

Thanks for your help with this. I was beginning to think it was impossible!

Thanks so much,

Don