1 Reply Latest reply on Jan 16, 2013 5:25 PM by rush_pawan

    Using captcha with comments component

    HN Doug

      I would like to require captcha whenever a comments component is added to a page. Any recommendations on the best approach?

        • 1. Re: Using captcha with comments component
          rush_pawan Level 4

          Hello Doug,

           

          For above requirement i would suggest you to override comments "/libs/collab/commons/components/comments" component locally to your project and then directly include captcha component at template level by modifying "/libs/collab/commons/components/comments/form.html.jsp" and inserting below include under the <form> tag at proper location.

           

          For example:

          <sling:include resourceType="foundation/components/form/captcha" replaceSelectors="captcha"/>

           

          Dont forget to add  replaceSelectors="captcha" because it will allow you to override all other selectors.

           

          Now inserting above include will include captcha inside comments <form> tag but you have to put validation code in same scriptlet "/libs/collab/commons/components/comments/form.html.jsp" on form submit to validate the captcha value.

           

          Also you can modify /libs/collab/commons/components/comments  component dialog by adding an extra property whether to add captcha as part of comment component or not which will give more flexibility to your comment component. You need not to worry about comments comment (when user comment on already provided comment) because "/libs/collab/commons/components/comments/comment" component form.html.jsp indirectly uses /libs/collab/commons/components/comments/form.html.jsp

           

          I hope it helps you to proceed. Let me know for more information.

           

          Thanks,

          Pawan