Hello,

I'm trying to setup a captcha in a form.

I've added the zend form element captcha to the form, and printed it with
formElement($form->get...);

Everything works ok. The image is displayed, the input field is created. But
when i submit my form, i always get an empty captcha error.

$form->getData()

Array
(
    [email] => [email protected]
    [captcha] => Array
)

$_POST

Array
(
    [email] => [email protected]
    [captcha] => Array
        (
            [id] => 0ea5a030a05003e2dbf60b3056fb8f18
            [input] => dgdfgdfg
        )

)


$form->getInputFilter()->getMessages();

Array
(
    [captcha] => Array
        (
            [missingValue] => Empty captcha value
        )

)

$form = new Form();

$captchaImage =  new \Zend\Captcha\Image(  array(
                'font' =>'./fonts/arial.ttf',
                'width' => 250,
                'height' => 100,
                'dotNoiseLevel' => 40,
                'lineNoiseLevel' => 3)
        );
        $captchaImage->setImgDir('captcha');
        $captchaImage->setImgUrl('captcha');

        $form->add(array(
            'type' => 'Zend\Form\Element\Captcha',
            'name' => 'captcha',
            'options' => array(
                'label' => 'captcha',
                'captcha' => $captchaImage,
            ),
        ));

(...)

Why might be happening?

Thanks.



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-Captcha-validation-returns-always-empty-tp4661060.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to