Hello, 
I'm using Zend_Form with Zend_Filter for elements, and I meet a weird
problem about filtering when I submit the form...

A form example :

$form = new Zend_Form();
$form->setMethod('post');
                
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Put your name here')
          ->addFilter(new Zend_Filter_HtmlEntities())
          ->addValidator(new Zend_Validate_NotEmpty());
$form->addElement($name);

$submit = new Zend_Form_Element_Submit('submit');
$form->addElement($submit);

if ($this->_request->isPost())
{
        if ($form->isValid($_POST))
        {
                // Process data         
        }
}

If I put $name->setValue(" é ") (e-acute), the character is immediately
filtered with Zend_Filter_HtmlEntities and the displayed value in the text
box is " &.eacute; " (without the '.', because forum converts html tags).
And when I submit the form, Zend_Filter_HtmlEntities process again, and the
new value of my text box is " &.amp;eacute; "...

It is possible just filtering output data (when the form is submitted) and
not input data (when I put data with setValue() or $form->populate() ) ?

http://zend-form.tjeu.be/user/signup This Zend_Form demo  does not have this
problem, but the latest version of ZF seems to have it...

Any idea ?

Thanks (and sorry for my bad english).
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-and-filtering-data-tp15412038s16154p15412038.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to