AEM’s dropdown comes with a simple and useful feature, to toggle visibility of other Dialog fields based on its selection.
An OOTB implementation is available for component “/apps/core/wcm/components/list/v1/list”
Let’s quickly check how to configure it (verified on AEM 6.3 with Coral-3 dropdown):
Step 1: Register dropdown that is supposed to show/hide other dialog fields.
Achieved by adding “granite:class” as “cq-dialog-dropdown-showhide”
Step 2: Identify the target dialog fields
This is achieved in 2 small steps:
- Informing dropdown about the class that all target elements would have, i.e :
- Add a new child node “granite:data” to the dropdown
- Add property “cq-dialog-dropdown-showhide-target” as “.<some_class_name>”
- Adding the class to all target dropdown fields, i.e:
- Add “granite:class” as “hide <some_class_name>” to all target dropdown fields.
- Add “granite:class” as “hide <some_class_name>” to all target dropdown fields.
Step 3: Define dropdown’s value for which to show the target field
This is achieved in 2 small steps:
- Add ‘value’ property to all options of the trigger dropdown
- Declare dropdown value for which to display the target dialog field
- Add a new child node “granite:data” to the dialog field
- Add property “showhidetargetvalue” as “<required_dropdown_option_value>”
Hi
I have used this validation for checkbox , there are some required fields are present inside it ,when i check in the box. The problem is even when i don’t check in the box ,because of these required fields i am not able to submit the dialog. How to overcome this problem??
LikeLike