In Drupal 7 this simple Form-Element doesn't work properly: http://drupal.org/node/743056

$form['my_captcha_element'] = array(
  '#type' => 'captcha',
  '#captcha_type' => 'captcha/Math',
);

The entered result will not validate.
Why? function captcha_validate() looks for some values in $form_state (look below) but all available Infos are in $form_state['values']['my_captcha_element'].
So no validation can made.

function captcha_validate($element, &$form_state) {

  $captcha_info = $form_state['captcha_info'];
  $form_id = $captcha_info['form_id'];

  // Get CAPTCHA response.
  $captcha_response = $form_state['values']['captcha_response'];

  // Get CAPTCHA session from CAPTCHA info
  // TODO: is this correct in all cases: see comment and code in previous revisions?
  $csid = $captcha_info['captcha_sid'];
  ...

Is there any callback I have to place ?

Greetings from Hamburg

Comments

soxofaan’s picture

Can you try it with the latest nighly build?
it contains this commit:
http://drupalcode.org/project/captcha.git/commitdiff/538446c3dcf0abdf060...
which should fix your issue, I hope

(also see http://drupal.org/node/1024370#comment-4876146)

kle’s picture

soxofaan - I like to kiss your feet...
This works like a glance for me !

soxofaan’s picture

Status: Active » Closed (fixed)

no problem