Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Script for condition in dropdown

Avatar

Former Community Member

If dropdown "A" is no and dropdown "B" is

also no. "C" becomes visible.

I need help with a script for this all that I can come up with is:

if

(xfa.event.newText == "Yes"){

Yes.presence

= "visible"

}

else {

Yes.presence

= "invisible"

}

and this does not work for this instance.

1 Accepted Solution

Avatar

Correct answer by
Level 7

First, put bound values on the dropdown items in the "object" pallet "Binding" tab:

Like:

Yes has bound value = 1

No has a bound value = 0.

Then,

Put on the "exit" event on both dropdown boxes and choose "JavaScript" for the scripting language:

//////////////////////////////

if (this.rawValue == "1" && B.rawValue == "1")

{

     C.presence = "visible";

}

else

{

     C.presence = "invisible";

}

//////////////////////////////

modify the first line to refenence A.rawValue when you add this script to the B dropdown box.

That should do it.

Good luck,

Stephen

View solution in original post

2 Replies

Avatar

Correct answer by
Level 7

First, put bound values on the dropdown items in the "object" pallet "Binding" tab:

Like:

Yes has bound value = 1

No has a bound value = 0.

Then,

Put on the "exit" event on both dropdown boxes and choose "JavaScript" for the scripting language:

//////////////////////////////

if (this.rawValue == "1" && B.rawValue == "1")

{

     C.presence = "visible";

}

else

{

     C.presence = "invisible";

}

//////////////////////////////

modify the first line to refenence A.rawValue when you add this script to the B dropdown box.

That should do it.

Good luck,

Stephen