Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Depending on the drop down answer, another question will appear

Avatar

Level 2

I am creating a document where a question such as "What country were you born in?" is asked.  If the answer is United States, then another field will pop up asking what state.  How do I do this?

1 Reply

Avatar

Level 10

Hi,

You are right to make the first question a drop down, because if it was a textfield and a user put in US, then the script would fail.

In the dropdown have the binding set to specify value. Note down the value for the "United States", let's say 4.

Then an exit event would look something like:

if (this.rawValue == 4)

{

     stateQuestion.presence = "visible";

}

else

{

     stateQuestion.presence = "hidden";

}

In the form set the initial/default presence of the stateQuestion to invisible or hidden (Object/Field).

Good luck,

Niall

ps happy independence day