Add reCAPTCHA To Custom Component


In this tutorial I will show you how to easily add Joomla’s built in reCAPTCHA to any custom component.

reCaptcha Screenshot

First make sure that you setup reCAPTCHA in Joomla plugins and enable as your default in ‘Site’ configurations.

Step 1
Open your component/MYCOMPONENT/model/forms/myform.xml and add the following

									description="Enter text in the box"

Step 2
Open and edit component/MYCOMPONENT/views/myform/tmpl/default.php then add the following where you like the captcha displayed.

	<div class="row">
	      <div class="form-group col-sm-12">
			<div style="margin-bottom: 10px;" class="col-sm-2"><label class="control-label"><?php echo $this->form->getLabel('captcha'); ?></label></div>
			<div class="col-sm-8"><?php echo $this->form->getInput('captcha'); ?></div>

That’s it! Your form will now display and validate captcha when the form is submitted.

Please Post Your Comments & Reviews

Welcome to Western Studios

We provide professional website and mobile softwares including Joomla, Wordpress and more.