Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

open form with according layout

Avatar

Level 5

Hi All.

In my form when user fill the form the textField get some value. Then user save the form. Then form saved and closed. Based on value of textField I would like to open form with according layout.

What event I must to use if I have some conditions:

if textField1==3 then I would like to show only subForm1 when form is open;

if textField1==2 then I would like to show only subForm2 and subForm3 when form is open.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 7

Simplest way is with an if statement, switch would work also.

In the Form's docReady event [form1::docReady - (JavaScript, client)] put this:


if(textField1.rawValue == 3) //if the textfield is 3, show subForm1
{
subForm1.presence = "visible";
}

else if(textField1.rawValue == 2) //if the textfield is 2, show subForm2
{
subForm2.presence = "visible";
}

else //if the textfield is anything else, do nothing.
{}

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

Simplest way is with an if statement, switch would work also.

In the Form's docReady event [form1::docReady - (JavaScript, client)] put this:


if(textField1.rawValue == 3) //if the textfield is 3, show subForm1
{
subForm1.presence = "visible";
}

else if(textField1.rawValue == 2) //if the textfield is 2, show subForm2
{
subForm2.presence = "visible";
}

else //if the textfield is anything else, do nothing.
{}