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

Another dropdown question

Avatar

Former Community Member

I am trying to find a script to do the following:

A=no B=no then C=visible

A=yes B=no then C=visible

A=no B=yes then C=visible

A=yes B=yes then C=hidden

1 Accepted Solution

Avatar

Correct answer by
Level 10

Did you put similar script in the exit event of the second dropdown?

Were you able to follow the example?

If you need the object presence to be explicitly set up both dropdowns then replace the switch with an if statement like Stephen's example.

I would not be inclined to use single letters for object names. You increase the chance of using a reserved name, like h, w, x, y...

Niall

View solution in original post

3 Replies

Avatar

Level 10

Hi,

Try similar script in the exit events of the dropdowns:

var vCheck = Number(this.rawValue) + Number(dropB.rawValue);

switch (vCheck)

{

     case 0:

     letterC.presence = "visible";

     break;


     case 1:

     letterC.presence = "visible";

     break;

    

     case 2:

     letterC.presence = "hidden";

     break;

}

This should get you started, example here: https://acrobat.com/#d=mvZKlOdoREpa*giIoAaKpA

Good luck,

Niall

ps l just see that Stephen has a similar solution...

Avatar

Former Community Member

This is what I am trying to use:

form1.#subform[0].#subform[4].pp::exit - (JavaScript, client)

var

vCheck = Number(this.rawValue) + Number(p.rawValue);

switch

(vCheck)

{

case 0:

no1.presence

= "visible";

break;

case 1:

no1.presence

= "visible";

break;

case 2:

no1.presence

= "hidden";

break;

}

I am getting "no1" as visible when I have "yes" selected in the first dd

I must be doing something wrong.

Avatar

Correct answer by
Level 10

Did you put similar script in the exit event of the second dropdown?

Were you able to follow the example?

If you need the object presence to be explicitly set up both dropdowns then replace the switch with an if statement like Stephen's example.

I would not be inclined to use single letters for object names. You increase the chance of using a reserved name, like h, w, x, y...

Niall