Datamanager 2 recaptcha widget

Uses the reCaptcha service to provide Captcha authentification to a form.

The captcha is completely auto-generated, you should not have to worry about any defaults. The captcha rendering is done by external service. reCaptcha uses it's service for digitizing old books.

Security considerations: reCaptcha is valid for only one post. If host reloads a page a new reCaptha is created

Available configuration options:

Integration Guide:

Integrating Captcha support does not need any changes to your components, you just have to add a new field into your DM2 schema using the recaptcha type/widget with null storage:

'recaptcha' => Array
    'title' => 'User Verification',
    'storage' => null,
    'type' => 'recaptcha',
    'widget' => 'recaptcha',

reCaptcha is configured by setting private and public keys to snippet sitegroup-config/midcom.helper.datamanager2/config

'recaptcha_privkey' => 'get key from',
'recaptcha_pubkey' => 'get key from',
package midcom.helper.datamanager2


_on_initialize ()

The initialization event handler creates the captcha passphrase (if necessary).


booleanIndicating Success

add_elements_to_form ($attributes)

Adds a simple single-line text form element at this time.



freeze ()

Freezes the Input Element

is_frozen ()

Checks if the input element is frozen.

sync_type_with_widget ($results)



unfreeze ()

Unfreezes the Input Element

validate ($fields)

QF Valiation callback which verifies the passcode against the Captcha.





mixed $_private_key


mixed $_public_key

Public and private keys used by recaptcha TODO: These could come from configuration

mixed $_validated


\HTML_QuickForm_Element $_element

The input textbox used which needs to be frozen when operating on the captcha.