Why zend_form cannot populate inputs with records

2019-09-01 03:35发布

问题:

I have zend application connected to Firebird database via ZendX library. It has windows-1250 charset. I am trying to use zend_form to create edit form and populate it with db values. It works with records free of diacritic characters and data is displayed properly, it's editable. Problem occurs whenever there are special characters, and form inputs are empty.

 $form->addElement(
                          'textarea',
                          'POD',
                          array(
                            'value' => $this->ksiega['POD'],
                            'attribs' => array( 'class' => 'pod'),
                          )
                        );
                $form->setElementDecorators(array(
                'ViewHelper',
                'Errors'
              ));

This shows empty input fields.

<textarea name="POD" id="POD" class="pod" rows="24" cols="80"><?=$this->ksiega['POD']?></textarea>

This code works. What am I not aware of here?

回答1:

Think problem is that an textarea has no value attribute (?).

You could try:

$elem = $form->getElement('POD');
$elem->setValue($this->ksiega['POD']);