This code implements honeypots (http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx/), a user-friendly alternative to CAPTCHA for preventing spam. Easy and accessible for users and highly effective. Easy to implement in Dotcms too:
You can also use JavaScript to fill in the field and hide it, so the user doesn't see or have to do anything at all. Caveat: this is susceptible to spambots that can run JavaScript.
The code below includes two snippets that you would incorporate in your form: some HTML (which gets hidden via JavaScript) and some code. The "URL" field is hidden only via JavaScript so that a human viewing your page with JavaScript turned off can still pass validation.
## include this part in your form <p class="text"> <label for="url">We have to ask a very simple question to make sure you're human. What colour is the sky?</label> <input type="text" name="url" id="url" maxlength="225" value="Please remove this text" autocomplete="off"> </p> ## end ## include this part at the bottom of your page <script> $(function() { "use strict"; $('#url').parent().hide(); $('input').focus(function(){ $('#url').val('bluE'); // Use unusual capitalization so we can identify which users had this field filled in for them by JavaScript }); }); // jQuery </script> ## end