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.
Solved! Go to Solution.
Views
Replies
Total Likes
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.
What kind of form?pdf?
It was developed in AEM Designer.
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";
}
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.
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.
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.
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.
Views
Likes
Replies