These pages have a draft status.

MyCaptcha1 is a CAPTCHA implementation for Drupal 5.x. A CAPTCHA is a test that tries to determine whether a user is human (learn more).
The combination of MyCaptcha and Form Store enables you to add captchas to arbitrary forms2 on your site without modifying a single line of code.
While MyCaptcha provides much of the same functionality, it is not related to the Captcha and TextImage modules by Fabiano Sant'Ana that can be downloaded from Drupal.org.
1Yes, a lousy name.
2Due to the way the Drupal login form has been coded, it cannot be protected by MyCaptcha.
When you find a bug, please check whether it is a known issue or already present in the existing queue. If your bug is new, please file a bug report. If you require support, you may want to post a support request. Please understand that support requests are answered on a 'best effort' basis.
If you like MyCaptcha and wish to do something in return, consider a small donation via PayPal that will enable me to shorten my wishlist.
Before installation, ensure your system meets the requirements.
While MyCaptcha supports PostgreSQL, Form Store doesn't (yet; there's an untested patch in the Form store issue queue).
MyCaptcha cannot be used alongside the modules TextImage and Captcha from Drupal.org.

form_store into sites/all/modules/ using a decompression utility (7-zip).mycap into sites/all/modules/ using a decompression utility (7-zip).Visit Administer » Site building » Modules (admin/build/modules) and check the modules:
Save the configuration. Both Form Store and MyCaptcha will apply all necessary changes to the database.

The first tab of Administer » Site configuration » Captcha (admin/settings/mycaptcha) enables you to select the captcha type (math or image) that will be used site-wide. It also contains the clickable sentence "Captcha settings for ..." for each role defined on your site.
When you click on such a sentence, for example, "Captcha settings for anonymous user", a box will open as in the image on the right. This box lists the various forms you can use a captcha on. Simply check the relevant forms and repeat for the other roles on your site (if necessary). Click Save and you're done.

Suppose you wish to enable image captchas for the user registration page. First, select Image captcha for the captcha type. Then, open the "Captcha settings for anonymous user" setting box by clicking on the title. Check the box in front of "register a user account" and click save. If you now logout and visit user/register you'll see an image captcha on the registration form.
Settings for both captcha types are available via tabs on Administer » Site configuration » Captcha (admin/settings/mycaptcha). See for more information:
Visit the Advanced configuration guide to learn how to add a captcha to forms not listed on the Captcha settings page.

The tab 'Images' on Administer » Site configuration » Captcha (admin/settings/mycaptcha/image) gives access to a few settings to influence image captcha generation.
Next come a number of settings that add noise to the picture to make solving the captcha more difficult. As you can see in the examples below, those settings can be combined. Overdoing it might lead to a high percentage of captchas that aren't solvable by your visitors.
Be aware that some settings make it more time consuming, not impossible for a program to solve a CAPTCHA; most despeckle algorithms can clean up the dot noise, but they cost time.
| CAPTCHA | Settings |
|---|---|
![]() |
No additional noise |
![]() |
Double vision |
![]() |
Add dots as noise |
![]() |
Add lines as noise |
![]() |
Double vision, add dots as noise |
![]() |
Add dots as noise, add lines as noise |

The tab 'Math' on Administer » Site configuration » Captcha (admin/settings/mycaptcha/math) doesn't contain a whole lot of settings. The only configurable option right now is the maximum answer of the math captcha. This is a measure of the difficulty of the captcha for humans (at least for those who can't find Calculator in their Start menu). The higher the maximum answer, the lower the chance that a bot guesses the right answer.
Note: It would be fairly easy to write a bot that could solve this kind of captcha.

Suppose you want to add a CAPTCHA to the site-wide contact form. As you enable the Contact module and configure the various contact settings, you realize you're out of luck; The Captcha settings page on Administer » Site configuration » Captcha (adminster/settings/mycaptcha) doesn't list the contact form!
Now what?
This is the part where a bit of work is required. In order to add a CAPTCHA to arbitrary forms, MyCaptcha utilizes the helper modules Form store and Form Collect. The module Form store provides MyCaptcha with its list of forms, whereas Form Collect is an ultrasmall helper that can add any form to the Form Store.

As you can see in the image above, the contact form isn't listed in the Form Store. So, check whether the module Form Collect is enabled (admin/build/modules) and do as the help text says; Visit Administer » Site configuration » Form Store, tab Collect forms (admin/settings/form-store/collect).

Simply check "Collect forms while browsing the site" and save the configuration. Now, all you have to do is visit the forms you want to add to the Form Store, in our case the form on the path contact. The moment you, or another visitor views the form, it is added to the Store. Return to Administer » Site configuration » Form Store, tab Collect forms (admin/settings/form-store/collect) to disable the collection.
You will now see that the contact form, with the cryptic name contact_mail_page has been added to the Form Store.
You can use the Description field to provide a more friendly description. This description will, when available, be used by MyCaptcha. To edit or remove a form, click edit, then choose the appropriate action.
In our case, we will add the description "contact form" to the form with the internal name contact_mail_page, so we'll have a less confusing Captcha settings page.

After all this, you can visit Administer » Site configuration » Captcha (adminster/settings/mycaptcha) once more. The contact form is now listed on the page and a CAPTCHA (here in the most unreadable variant) can be added to it.

While the example just adds one form to the Form Store, you can add multiple forms in one sitting.
When you finish Form collection, visit Administer » Site configuration » Form Store, tab Collect forms (admin/settings/form-store/collect) to disable collection. You can now disable the module Form collect (on admin/build/modules).
Other known issues may be found in the MyCaptcha forum.
MyCaptcha uses fonts by Bitstream and a wave distortion function from KCAPTCHA by Kruglov Sergei.
MyCaptcha is Copyright © 2007 by Heine Deelstra. Please see the files LICENSE.TXT and fonts/LICENSE.txt in the download for licensing terms.
The most up to date credits can be found in the Thanks & Credits section of README.txt.
Under construction.
From the Forms API quickstart guide:
The Drupal forms API is a powerful leap forward. It also allows for almost unlimited possibilities for custom theming, validation, and execution of forms. Even better, ANY form (even those in core) can be altered in almost any way imaginable--elements can be removed, added, and rearranged.
Forms API goes by the moniker FAPI.
Before we dive into the details of the Forms API, we need a little scaffolding code to enable you to test the examples on a site. Here we map the URL example/page to the function call example_page(). We'll later fill this function with relevant code.
The example implements the following hooks:
To use the example code on your site, you can save it in sites/all/modules/example/example.module together with example.info:
This is in progress.
The pivotal FAPI function is drupal_get_form(); it retrieves a form from a builder function, passes it on for processing, and renders the form or redirects to its destination as appropriate.
One can distinguish three stages in the life of a form:
The building stage starts when you call drupal_get_form('form_id'), with the function scurrying away to find the builder function of the appropriate form. To keep it simple for now; drupal_get_form checks if the function form_id() exists, then calls it, expecting a proper FAPI array in return. Alternatives to this approach will be discussed in future chapters.
In the code below, we fetch a form with the identifier myform, build by the function myform(), specifying a select box, a textfield and a button.
This builder function supplies a number of fields defined by keys of the nested forms array. The '#key' => 'value' pairs are properties of the field. We'll deal with those later, but you can take a look at the FAPI reference to get a feel for the available properties.
When the user clicks a button on the form, data is send back to the server. Drupal reruns the form builder function and then starts the validation stage. A few properties are automatically validated. Required fields, maximum input length (textfields), whether selected options are valid options and the internal form token (to protect against cross site request forgeries).
There are multiple ways to do some validation yourself, but the easiest is to provide a [form_id]_validate function. This takes two arguments: the form id and an array of values. In the example we use a custom validation function to make sure that the number of siblings is numeric. By setting an error on the field 'siblings' we ensure that the form is redisplayed to the user with the error message "Please enter a number".
When the form validation is successful, the next stage starts: submission.
If you are familiar with the Drupal forms API you know the concept of form elements as the basic building blocks of any form. Drupal provides several types of elements, some rather straightforward (#type textfield), some more advanced (#type password_confirm).
It is also possible to define custom form elements that enable you to implement complex widgets with ease.
At the moment, the focus of Elements is the tableselect widget. It provides a clean, easy way to create tables with one checkbox per row, multi-row selection and a select all checkbox, without making your code a complicated mess.
You can use the following code to create an example.module which you can use to experiment with the examples in this guide.
The comboselect element has not yet been included in Elements. You can follow its development at #268424.
The comboselect written by John Morahan gives you a select type element with an 'Other' option. When the user chooses this option; a textfield appears.
The form element tableselect provides a clean, easy way to create tables with one checkbox per row, multi-row selection and a select all checkbox, without making your code a complicated mess:

The basic properties of the tableselect element are #header which accepts an array of key => value pairs to generate the header from and #options, which receives an array of rows.
The basic structure looks like the following:
The tableselect element relies on the keys to match columns with the appropriate header. The element will behave like the #checkboxes type. You'll get an array of values in your submit function, with the checked ones set to nonzero so you can array_filter them to get the checked rows.
Which results in:

The tableselect element supports use with tablesort_sql. Simply modify the header to the format described in theme_table.
