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

SOLVED

Hide dropdown in AEM Designer

Avatar

Level 3

I have a form with a dropdown field called "Chapter Officer" and when a user does not select anything and goes to the next field, I want this field to be hidden.

 

Can anyone help me with this?

 

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Use the exit event of the dropdown where the user is supposed to make an selection.

Chapter_Officer.presence = this.isNull ? "hidden": "visible";

 

Btw. You cannot use objects names that begin with a digit, since this isn't allowed by XML standards. A SOM expression as Chapter_Officer.0.0 can't work. 

View solution in original post

7 Replies

Avatar

Level 5

Add a script like the below as per your forms field in the "enter" event.

 

 

form1.nextField::enter - (JavaScript, client)

if(DropDownList1.rawValue==null || DropDownList1.rawValue==""){
DropDownList1.presence = "hidden";
}

Avatar

Level 3

I put the following code on the enter event of the dropdown list.

 

form1.#subform[0].Add_Sec.Sub1.CharterOff1.Chapter_Officer.0.0::enter - (JavaScript, client)
if(Chapter_Officer.0.0.rawValue==null || DropDownList1.rawValue==""){
Chapter_Officer.0.0.presence = "hidden";
}

 

It did not work as expected.

Avatar

Correct answer by
Level 10

Use the exit event of the dropdown where the user is supposed to make an selection.

Chapter_Officer.presence = this.isNull ? "hidden": "visible";

 

Btw. You cannot use objects names that begin with a digit, since this isn't allowed by XML standards. A SOM expression as Chapter_Officer.0.0 can't work. 

Avatar

Level 5

You need to put it in the enter event of next field, on which it needs to check the dropdown field value, whether it null or not.

 

Avatar

Level 10

Changing a fields presence from its enter event is a oneway as you can't make it visible again once it got hidden because the event will only execute when the field is visible.