Expand my Community achievements bar.

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

Community Advisor

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

Community Advisor

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.