Support Center

How to add CAPTCHA to your Drupal forms

Last Updated: Dec 04, 2013 06:43PM EET
In order to add a CAPTCHA challenge to any of your Drupal forms simply follow the instructions below.
 

Installation of the CAPTCHA module


You will have to install the “captcha” module (https://drupal.org/project/captcha) that will allow you to implement the CAPTCHA challenge.

Simply download the module and install it as any other module.

Once you have enabled the module you should configure it to generate the challenge you want. Note that you have the option to implement any of the alternative captcha challenges by installing the corresponding module of the “Additional CAPTCHA Modules” list (https://drupal.org/project/captcha).

For the sake of this guide we will implement the “Image” challenge for the contact form of our premium theme “Genteel”.
 

Configuring the CAPTCHA challenge image


First you need to configure the image challenge to generate the desirable image. Go to admin/config/people/captcha/image_captcha and configure the image challenge according to your needs. You have the option to change the font/character settings as well as the complexity (noise/distortion) of the challenge.



By changing each of the corresponding settings you will be presented with a demonstration at the top of the page so you can review the result.

You should start with something relatively simple and gradually increase the challenge complexity until you reach the desired result.

Once you have finished with your configuration you should assign the CAPTCHA challenge to the form that you want.
 

Assigning the image challenge to your form


Go to admin/config/people/captcha/captha and select as the default challenge the Image challenge. From the list below select from the dropdown select box either the “Default challenge type” or the “Image” option for the form that you want.



If the form you wish to add the captcha challenge does not exist in this list you have the option to add it manually. Generally module generated forms (e.g webforms) will have to be added manually.
 

Manually add a form to the captcha forms list


By using a tool like Firebug or the integrated into your browser “developer tools”, locate the form ID of your form. I.E. for our contact form of the Genteel theme the corresponding form ID is “webform-client-form-22”.



Go to the admin/config/people/captcha/captha page and add the form id to the input field at the end of the list making sure that you convert all dashes to underscores. This means that for the “webform-client-form-22” form you will have to enter “webform_client_form_22”.



Next select the “Image” option from the corresponding dropdown select box and finally hit the “Save configuration” button.

Your form will now display the image CAPTCHA challenge. Note that the CAPTCHA challenge is typically not displayed to the authenticated (logged in) users.



Enjoy!

Contact Us

[email protected]
http://assets3.desk.com/
false
morethanthemes
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete