ZF-4702: autocomplete=off on Zend_Form_Element_Captcha

Description

I would suggest adding autocomplete="off" to the captcha input field. Don't know if there is a valid-html policy for the framework. If so this could prove a problem since this is only valid in Html5, not html4.

Could be implemented using something like this:

/**
 * Constructor
 *
 * $spec may be:
 * - string: name of element
 * - array: options with which to configure element
 * - Zend_Config: Zend_Config with options for configuring element
 * 
 * @param  string|array|Zend_Config $spec 
 * @return void
 */
public function __construct($spec, $options = null) 
{
    parent::__construct($spec, $options);
    $this->setAllowEmpty(true)
         ->setRequired(true)
         ->setAutoInsertNotEmptyValidator(false)
         ->setAttrib('autocomplete', 'off')
         ->addValidator($this->getCaptcha(), true);
}   

Comments

No comments to display