Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Page Properties Show/Hide

Avatar

Level 2

We have implemented the Show/Hide of the page properties using cq-dialog-dropdown-showhide-target AEM 6.4. Show/hide things are working absolutely fine. When required:true is enabled for multiple fields  it is not allowing to submit unless we fill in required fields of the hidden fields.

Assume we have drop with below values. We have different fields for the selection in the dropdown in which few of them are mandatory. When we select xyz and try to submit. It is not submitted and shows required error in abc. I know it works as expected for component dialog. But seems it is not working for page properties. Do we have any other option to achieve it?

- Dropdown

------abc

------efg

------xyz

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

you can write your own logic and do validation based on displayed field. you can remove property validation(Boolean)=true.

and on dialog submit you can apply validation using javascript.

You can add class property e.g. granite:class(String)=someClass for selector for all the required filed and when you submit the form.

your selector would be like

$(".someClass").not(".hide").each( function(){

});



Arun Patidar

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

you can write your own logic and do validation based on displayed field. you can remove property validation(Boolean)=true.

and on dialog submit you can apply validation using javascript.

You can add class property e.g. granite:class(String)=someClass for selector for all the required filed and when you submit the form.

your selector would be like

$(".someClass").not(".hide").each( function(){

});



Arun Patidar

Avatar

Level 2

Implementing it using Jquery is fine. But wanted to understand if the behavior what we are seeing is expected or do we have any solution without any custom implementation.

Avatar

Level 10

Arun's answer is correct - you need to use some custom logic.

Avatar

Level 2

@prajwalreddi ,

I am facing some issue in implementing the show hide at page props level. can you share the xml and js here?

I can see its working if i keep the xml at component level.

For page props first time on page load logic works fine, But on save and submit its doesn't keep the values back. I am checking with existing the dialog from list component.

 i was just checking with this 

/apps/core/wcm/components/list/v1/list/cq:dialog

Avatar

Level 1

i also facing same issue hide and show working as expected in component level but not in page properties @shivamurthym775 did you get any solution.

@arunpatidar Do you have any solution for this.

Avatar

Community Advisor

Hi,

Page property dialog are different than the component dialog, and does not load the cq.authoring.dialog clientlibs

You have to load the show-hide-js using the extraclientlibs 

https://github.com/arunpatidar02/aem63app-repo/blob/master/js/dropdownshowhide-multifield.js 

 



Arun Patidar