Avatar

Level 10

Hi,

Have a look at this example: http://assure.ly/h7whb8, which shows the various options for the presence property.

In relation to populating the dropdown2, I would use its preOpen event and look back at the value of dropdown1. See examples here: http://assure.ly/jcTahK. When using the addItem() method, you can specify the Display Item and its Bound value.

addItem("This will be the display item", "This will be the bound value"); 

Depending on the number of items to be added, you could set up a pattern for the bound value, that you could then use in your if statement.

For example, the following script in the preOpen event of dropdown2:

// clear the dropdown displayed value and items

this.rawValue = null;

this.clearItems();


// repopulate the items based on dropdown1

if(dropdown1.rawValue == 1)

{

     this.addItem("Apples", "001");

     this.addItem("Pears", "hidden1");

     this.addItem("Oranges", "002");

     this.addItem("Bananas", "003");

     this.addItem("Grapes", "hidden2");

}

Then in the exit event of dropdown2 you could check the length of its rawValue. If this is greater than 6 characters, then it must be one of the options that you have hardcoded need to hide the other fields:

So in the exit event of dropdown2:

if (this.rawValue.length > 6)

{

     TextField.presence = "hidden";

}

I hope that makes sense,

Niall

snap :winking_face: