I've run into a problem where a Match CAPTCHA expects a specific response but does not allow for enough characters in the input field. For example:
10 - ? = 0
I go to enter 10 for the ?, and am only allowed 1 character in the input field.
Digging into the problem, it's actually a really easy fix. Open up match_captcha.challenge.inc, and on line 81 (create a newline before the return
), add:
$form_item['form']['captcha_response']['#maxlength'] = strlen($form_item['solution']);
Without this fix, you will only be allowed to enter as many characters long as the result (right side of the =, see line 63 in the same file). This change will allow you to properly enter up to as many characters as the solution requires.
Comments
Comment #1
soxofaan CreditAttribution: soxofaan commentedGood catch!
thanks
fixed by http://drupal.org/cvs?commit=230290
note: I solved it slightly different:
Comment #2
soxofaan CreditAttribution: soxofaan commentedstill some refining needed.
Just observed minor very low frequency problem with admin mode:
* captcha on create page node form and admin mode enabled
* go to create page node form (with solution = 10)
* preview
* form gets rebuilt with likely a solution different from 10
* drupal complains that the default value is larger than the maxlength permits (or something like that)
fix: maxlength should be the maximum length of all possible values in the enabled range, not the maximum of $x, $y and $result.
Comment #3
soxofaan CreditAttribution: soxofaan commented#2 fixed by http://drupal.org/cvs?commit=242336
Comment #4
soxofaan CreditAttribution: soxofaan commentedd5 also: http://drupal.org/cvs?commit=242344