How to Create Accessible CAPTCHAS

It's common for web developers to use CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) functionality for anti-spam verification to make sure HTML form responses are being generated by humans and not computer "bots".

Example of a visual CAPTCHA

The most commonly used CAPTCHA presents a visual of distorted text for the website visitor to interpret. Another alternative is the audio CAPTCHA, offering human verification to the blind and other visually impaired people. Unfortunately, both types of CAPTCHAS offer accessibility issues:

  1. People with visual disabilities use screen readers that cannot read a CAPTCHA.
  2. You cannot add ALT text to a CAPTCHA image, because then a bot would be able to read it, defeating the purpose of using it.
  3. Audio CAPTCHAs present difficulties for people with hearing disabilities.

SOLUTION: Use Text-based Logic Questions or Math Equations CAPTCHAs

Use a question rather than an image or audio to create CAPTCHA functionality.

A sample CAPTCHA question might be "Which animal is larger—an ant or a elephant?"or "What state is Boston located in?"

Another way to challenge: use math questions (e.g. "What is one plus three?").

Example of a math question challenge question that can replace a CAPTCHA

PHP Script Solution: All CAPS vs lowercase

For those of you who use PHP, here's a simple coding trick that enables you to create an accessible CAPTCHA on an HTML form. I have used this for years on client websites, and it works great.

At the bottom of your form, create a text field named Validate. Above the field, add a validation text code of capital letters and numbers (in this case GHW53405) that the user will need to enter in order to submit the form. Also let the user know that the validation code is case-sensitive.

validate1b

Once the user enters the validation text code and submits the form, add the following condition at the top of the PHP processing page:

<?php
if (strtolower($_POST['Validate']) != 'ghw53405') {
die('Sorry...you forgot to enter the special code in the form...hit your back key and try again. Please note that the special code is case-sensitive');
} else {

rest of script

}

Note that in the PHP condition you need to change the values of the capital letters used in the validation text code to lowercase (see bold above). The PHP function strtolower converts all the text characters of the submitted Validate string to lowercase. If the validation text code has been entered correctly, the rest of the script will process with no problem. If the validation code has been entered incorrectly, the submission will fail and the user will be directed back to the form.

Check Out This Additional Resource: The TextCaptcha service provides access to textual CAPTCHA challenges via a simple JSON or XML API over HTTP. http://textcaptcha.com

===

IS YOUR WEBSITE ACCESSIBLE?

By 2018, The U.S. Department of Justice (DOJ) will roll out official compliance guidelines concerning online accessibility for the disabled as part of the Americans with Disabilities Act (ADA).

DOJ will soon be expecting all websites to accommodate people with disabilities.

Whether DOJ will implement web accessibility standards is not a matter of "if", but "when."

Mary can test your website to determine if it meets these accessibility standards:

WCAG 2.0: 110 checkpoints covering A, AA and AAA W3 accessibility guidelines
Section 508: 15 US federal guidelines covered by 47 accessibility checkpoints

You will receive a full report and checklists of items on your website that need to be fixed in order to be compliant.

As a web developer since 1995, Mary can also make the coding changes to your website so it is compliant.

Contact Mary at mary@accessiblewebsiteservices.com or 508-768-8418 to find out more.

===