|
|||
|
None of the forums were labeled to be used for Zend_Form, and this seemed like the best one, so here goes...
I'm working on a project and using ZF. Slight learning curve, but once you're over that it's pretty powerful. I'm using it for everything I can (database, caching, logging, MVC, etc.) I'm using Zend_Form to generate a form with elements. Here's an example of an element I'm generating in one particular form Code:
$lastname = $this->addElement( 'text', 'lastname', array( 'filters' => array( 'StripSlashes', 'StripTags', array( 'HtmlEntities', array(ENT_QUOTES) ) ), 'validators' => array( array( 'StringLength', false, array( 0, 255 ) ), ), 'required' => true, 'allowEmpty' => false, 'label' => 'Last Name:', ) ); The problem I'm running into has to do with the htmlentities filter. Upon submission, StripSlashes removes slashes if gpc is enabled (custom filter), striptags removes HTML tags, and htmlentities converts the appropriate characters to htmlentities. All works just fine. Then when I pass the data to the form as such Code:
$form = $this->editContact( $result );
$form->setDefaults( array(
'firstname' => html_entity_decode( $result['contacts_first_name'], ENT_QUOTES ),
'lastname' => html_entity_decode( $result['contacts_last_name'], ENT_QUOTES ),
.......
) );
If I var_dump the value I'm passing it is correct (in this test case "o'Doe"), but the actual form field data being generated is like so Code:
<input type="text" name="lastname" id="lastname" value="o&#039;Doe"></dd> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|