views:

34

answers:

2

Hi,

I decode my zend-form with htmlEntities. This works great, but I would like to decode the input back when I repopulate the form back to the user. Is there a way to reverse the setElementFilter in Zend?

Example:

User fills in input field with

You & me

Data placed in the database:

You & me

I get the data back from the database and populate the input field with it:

You & me

I just want my ampersand (in this case) back and see this:

You & me

Thanks in advance,

+1  A: 

Hi ,

I usually repopulate my form if it was invalid or i wanted to edit some data

$form = new zend_form("name");
.......................
......................
$form->populate($this->_request->getAllparams());

or if wanted to fill the form with custom data

$form->populate($data);

and zend form will take care of filtering , validating and populating the form back http://framework.zend.com/manual/en/zend.form.forms.html

hope that would help

tawfekov
I'm using populate, but data isn't displayed filtered back....
Rick de Graaf
+2  A: 

Is there a way to reverse the setElementFilter

No. You should filter your data with html_entity_decode before populating your form

Maxence
That's all I wanted to know! Thank you!
Rick de Graaf