Originally asked on StackOverflow: http://stackoverflow.com/questions/34145668/execute-dialog-validation-on-activation-aem-5-6-1
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 (com.day.cq.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)?
Views
Replies
Total Likes
One suggestion from StackOverflow: http://stackoverflow.com/a/34160564/3192139
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?
Views
Replies
Total Likes
Hey Dave,
I understand your problem and before looking for any solution, I would like to know, following things:
--
Jitendra
Views
Replies
Total Likes
Hi Jitendra. Thank you for responding.
Views
Replies
Total Likes
Bump. Nobody has dealt with the same problem? No suggestions?
Views
Replies
Total Likes