Using ReCaptcha in your component

If you are using JForm on the frontend, then implementing a CAPTCHA plugin is very easy; you just need to add a field to your XML file, then add a couple of language strings. Edit the folio.xml file under /components/com_folio/models/forms/ and add the following field after description:

<field
   name="captcha"
   type="captcha"
   label="COM_FOLIO_CAPTCHA_LABEL"
   description="COM_FOLIO_CAPTCHA_DESC"
   validate="captcha"
   namespace="contact"
/>

Now, add the following language strings in /components/com_folio/language/en-GB/en-GB.com_folio.ini:

COM_FOLIO_CAPTCHA_LABEL="Enter code"
COM_FOLIO_CAPTCHA_DESC="This is to verify that you are a human"

Joomla! can use a variety of CAPTCHA plugins, but ReCaptcha is built-in; that is why ...

Get Learning Joomla! 3 Extension Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.