zend framework 1 Form - Note element lost its value if there is validation error -
i have note element in zend framework 1 form used registration. defined in format:
$captcha_reload = new zend_form_element_note('captcha_reload', array('value'=>"<div id='captcha_reload_div'> <a href='javascript:return false;' id='change-image'>change text.</a></div>")); $this->addelement($captcha_reload);
this element displays hyperlink , displays during registration page call.
the problem during form submission. note element doesn't displays (ie missing hyperlink) if there form validation error.
i have checked , tried code below:
$this->setdefaults(array('captcha_reload'=>"<div id='captcha_reload_div'> <a href='javascript:return false;' id='change-image'>change text.</a></div>"));
but still there no value if there form validation error.
for note element, have included following in zend registration form page:
class zend_form_element_note extends zend_form_element_xhtml { public $helper = 'formnote'; }
when form submitted over-riding value
property of element. there nothing being submitted, when form echo
ed again show form errors, value of element nothing well.
perhaps adding isvalid
function element?
// pseudo-code public function isvalid($value, $context = null) { $this->_setvalue("<div id='captcha_reload_div'><a href='javascript:return false;' id='change-image'>change text.</a></div>"); return true; }
this reset value custom text, , return true without doing checks (as know value want be). subsequently, when form echo
s again show value set in isvalid