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

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Dropdown menu selections canceling themselves out

Avatar

Level 3

Another dropdown issue. I have selection choice result canceling themselves out?

Is there a way to avoid this?

DD1 is the dropdown menu
TF(*) are just text fields

If(DD1.rawValue == "1")

{

TF1.presence = "visible"; TF2.presence = "visible"; TF3.presence = "visible";

}

else

{

TF1.presence = "hidden"; TF2.presence = "hidden"; TF3.presence = "hidden";

}

If(DD1.rawValue == "2")

{

TF2.presence = "visible"; TF3.presence = "visible"; TF4.presence = "visible";

}

else

{

TF2.presence = "hidden"; TF3.presence = "hidden"; TF4.presence = "hidden";

}

When I select "1" only TF1 shows

when I select "2" TF2, TF3, and TF4

For selection "1" TF2 and TF3 is being cancelled out? If so, then in selection "2", shouldn't only TF4 show up?

If there a solution here?

Thank you advance

1 Accepted Solution

Avatar

Correct answer by
Level 7

When I have done this type of thing I have found else scripts a little unreliable. The thing is, in this case it isnt needed at all, just put everything in the if statement. Hide and show objects in one place. It will work this way.

Eg

If(DD1.rawValue == "1") //when 1 is selected, show TF1, 2 and 3 but not 4

{

TF1.presence = "visible";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "hidden";

}

If(DD1.rawValue == "2") //when 2 is selected, show TF2, 3 and 4 but not 1

{

TF1.presence = "hidden";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "visible";

}

View solution in original post

0 Replies

Avatar

Correct answer by
Level 7

When I have done this type of thing I have found else scripts a little unreliable. The thing is, in this case it isnt needed at all, just put everything in the if statement. Hide and show objects in one place. It will work this way.

Eg

If(DD1.rawValue == "1") //when 1 is selected, show TF1, 2 and 3 but not 4

{

TF1.presence = "visible";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "hidden";

}

If(DD1.rawValue == "2") //when 2 is selected, show TF2, 3 and 4 but not 1

{

TF1.presence = "hidden";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "visible";

}

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now