'How to make textfield mandatory based on value of pathfield in aem
My question is in aem dialog if we have two fields one is pathfield and another one is textfiled, Now I want to make textfield mandatory if some value is entered in pathfield and also if no value is entered in pathfield then I dont want to make textfield mandatory.
Please help if someone knows the answer
Solution 1:[1]
If you are using Granite UI components, this, for the most part, is already resolved by setting
required="{Boolean}true"
which is often fine is all you want to check is that the user put something in the field.
But, for instance, if you have a multi-field, or RTE (resourceType of cq/gui/components/authoring/dialog/richtext), or an icon picker from ACS commons, or even your custom-developed dialog field, you may need to write a validator for a mandatory field and/or any other custom validation requirements.
There's a great article about writing custom validators here https://blogs.perficient.com/2017/11/06/aem-touch-ui-dialog-validation-new-best-practice-use-foundation-validation/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jwebb |
