Hi,
Breaking from previous post, I am posting this as a new subject.
I am using Zend_From to display captcha with custom error message.
When I make a wrong entry (intentionally), my custom error message is
not shown when form validates.
Sample code:
============
//first create an captcha image
$captchaimg = New Zend_Captcha_Image('captchaimg');
$captchaimg->setFont("../application/captcha/fonts/tahoma.ttf");
$captchaimg->setImgDir($_SERVER['DOCUMENT_ROOT'] . '/images/captcha/');
$captchaimg->setImgUrl("/images/captcha/");
$captchaimg->setWordlen('6');
//create user input for captcha and include the captchaimg in form
$adcaptcha = New Zend_Form_Element_Captcha('adcaptcha', array(
'captcha' => $captchaimg));
$adcaptcha->setLabel('Please enter the letters displayed below:');
$adcaptcha->setRequired(true);
$adcaptcha->addErrorMessage('Entered value did not match with
displayed image.'); <<<<<<< this part <<<<<<<<<
===================================
I have checked the HTML code through view source (after validation).
My error message is nowhere to be found in final HTML.
Question:
========
1. Is my way of setting custom error message correct?
2. If yes, why it is not shown? what else needs to be considered?
=======
Thanks
--
=======================
Registered Linux User #460714
Currently Using Fedora 8, 10
=======================