2 Replies Latest reply on Apr 22, 2013 11:58 PM by Ray Muirhead

    Recommended approach for validating page content on activation?

    Ray Muirhead Level 1

      Hi,

       

      Is there a recommended approach to implementing validation in CQ5 (we are using 5.5) that will run when a Page is activated?  I have been reading up on different approaches for this, but have not been able to find a clear solution.

       

      The requirement that I have is for a News article to only be published if all of it's mandatory fields have been supplied - for example Heading, Image, Body Text, Author.  Simply implementing validation on the edit dialog doesn't really solve the issue, as each component is editable separately, so it is easy for a content author to miss entering the Author for example.

       

      What I'm trying to accomplish is to run some custom validation code when the page is replicated, and cancel the replication if the validation does not pass.  Ideally this would show a "Validation Failed" or similar notification in the CQ user interface, the same way that the "Activation Successful" notification is shown.

       

      The approaches that I have investigated so far are:

       

      Replication Action Event Handler

      http://helpx.adobe.com/cq/kb/ReplicationListener.html

      - This triggers at the right time and provides sufficient information (path to page), but doesn't provide a mechanism to stop the replication.

      - Potentially this could be combined with further service calls to stop replication?

       

      Workflow Action Event Handler

      http://dev.day.com/docs/en/cq/current/workflows/wf-extending.html#par_title_0

      - This doesn't seem to fire when activating a page

       

      Custom Replication Agent

      http://dev.day.com/docs/en/cq/5-5/deploying/configuring_cq/replication.html

      http://forums.adobe.com/message/4785913#4785913#4785913

      - This would provide a hook for validation, but seems like massive overkill - is there no way to simply hook into the existing replication process and cancel it if the page is not valid?

       

      Any advice on how to best accomplish this would be much appreciated.

       

      Thanks,

      Ray