Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Execute Dialog Validation on Activation (AEM 5.6.1)

Level 4
Level 4

Originally asked on StackOverflow:

AEM/CQ5 (5.6.1) appears to have a deficiency in how content validation works in the out-of-the-box product.

Though component dialogs have a mechanism for validation, the validators only get executed when the dialog is open. The problem is that a component can be added to a page, and without opening the component's dialog, the page can be activated with the unconfigured component. Even worse, it's possible to activate a page without completing mandatory configuration in its page properties dialog.

I have previously dealt with the latter by creating a replication preprocessor ( which validated the expected page properties. This is suboptimal, since it has its own validation logic, which may diverge from the dialog validators. It also does nothing to validate components on the page.

Is there any way to leverage the validation rules in component dialogs for validating content prior to activation? If not, do you have any other suggestions for improving pre-activation content validation (page and component properties)?

4 Replies
Level 4
Level 4

One suggestion from StackOverflow:

This suggestion is to include a hidden field in the dialog for each and every component, which would set a property (eg, isComplete) on the component's node when the dialog is opened and saved.  Since the save will only succeed if validation is successful, the property will only be set when the validation rules have passed.  The activation preprocessor could then iterate over all nodes under a page and ensure that the property exists.

While this approach seems viable, it seems like a lot of work to add this field to all components (even if we ignore any components located in /libs/).  Any other recommendations for leveraging the dialogs' validation rules?

Level 9
Level 9

Hey Dave,

I understand your problem and before looking for any solution, I would like to know, following things:

  1. What do you mean by pre-activation content validation?. Is it something like manual review or automatically detect content issue?.
  2. What kind of pre-activation validation do you expect at page or component properties?. 



Level 4
Level 4

Hi Jitendra.  Thank you for responding.

  1. We do not enforce manual review.  Even if we did, the intent would be to review copy (text) and layout; it is unlikely that a manual reviewer would detect issues with misconfigured properties, unless there was a visual discrepancy.  As mentioned, we currently have a replication preprocessor which automatically runs a set of validation rules on the page properties prior to replication, cancelling the activation if any property fails the validation.
  2. We would like to extend the current approach to validate not only the page properties, as it currently does, but also all components on the page.  More importantly, we would like to leverage the validation that already exists on the page and component dialogs, so that the validation rules are only defined once.  Our current solution duplicates the page dialog's validation rules in the preprocessor; this means that the rules exist in two places, which introduces a risk of the dialog and preprocessor validation rules diverging.
Level 4
Level 4

Bump.  Nobody has dealt with the same problem?  No suggestions?