home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (captcha.js)

This example Drupal source code file (captcha.js) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

attach, checked, click, edit-captcha-add-captcha-description, else, function, hide, if, is, jquery, php

The captcha.js Drupal example source code

// $Id: captcha.js,v 1.4 2010/02/20 16:57:41 soxofaan Exp $

(function ($) {

Drupal.behaviors.captchaAdmin = {
  attach: function(context) {
  	// Add onclick handler to checkbox for adding a CAPTCHA description
  	// so that the textfields for the CAPTCHA description are hidden
  	// when no description should be added.
    // @todo: div.form-item-captcha-description depends on theming, maybe
    // it's better to add our own wrapper with id (instead of a class).
  	$("#edit-captcha-add-captcha-description").click(function() {
  		if ($("#edit-captcha-add-captcha-description").is(":checked")) {
  			// Show the CAPTCHA description textfield(s).
  		else {
  			// Hide the CAPTCHA description textfield(s).
  	// Hide the CAPTCHA description textfields if option is disabled on page load.
  	if (!$("#edit-captcha-add-captcha-description").is(":checked")) {



Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal captcha.js source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.