Using captcha in a custom Joomla component

Using google recaptcha into a custom joomla component is so much easy. In this short post, I will show you how you can do it in just 10 minutes.

For using captcha, you first have to get the google recaptcha key by going here Now login to joomla backend, go to “plugins” from the extensions menu and find out recaptcha plugin. Now open its edit page and put the google recaptcha public and private keys in the keys parameter option as shown in the figure below.

After you have entered that, click the “Save” button.

Now come to your component view default.php file. Copy and paste the following code before the form submit button, or where ever you want to show your recaptcha. {loadposition chitika}



$dispatcher = JDispatcher::getInstance();



//Now, the html code will automatically be thrown in the following div.

<div id=”recaptcha”></div>

Put this code in your controller file or in any other file where you are processing your form.


$input = JRequest::get('post');


$dispatcher = JDispatcher::getInstance();

$result = $dispatcher->trigger('onCheckAnswer',$input['recaptcha_response_field']);

    die('Invalid Captcha Code');


And thats it. It is just a simple process and requires only a few minutes to setup. {loadposition social}


Add a Comment

Your email address will not be published. Required fields are marked *

Enjoy best web development services at an affordable price. Looking forward to build a good relationship and serve you better...


My name is Nohman Habib and I am a web developer with over 10 years of experience, programming in Joomla, Wordpress, WHMCS, vTiger and Hybrid Apps. My plan to start is to share my experience and expertise with others. Here my basic area of focus is to post tutorials primarily on Joomla development, HTML5, CSS3 and PHP.

Nohman Habib


Request a Quote