How to use data from Zend_Db_Table in a Zend_Form

I have create a form class for editing deleting and add users to a database. If I want to edit a user how can I simply supply the information of the user to the form.

I use a Zend_Db_Table to get the data from the database.

This is the userForm class:

class UsersForm extends Zend_Form
    public function init ()
    	$username = new Zend_Form_Element_Text('username',array(
    		'validatrors' => array(
    		'filters'	=> array(
    		'required'	=> true,
    		'label'		=> 'Gebruikersnaam:'

    	$password = new Zend_Form_Element_Password('password', array(
    		'validators'=> array(
    			array('StringLength', array(6,20))
    		'filters'	=> array('StringTrim'),
    		'required'	=> true,
    		'label'		=> 'Wachtwoord:'

    	$actif = new Zend_Form_Element_Checkbox('actif', array(
    		'label'		=> 'actif'));


    		array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')),
    		array('Description',array('placement' => 'prepand')),

Thank you,

Ivo Trompert


This is done with:


where $data is an array with your table-row-data where the field names have to match the ones from the form. Zend will do the rest.

Need Your Help

What is the correct way to redirect_to in AJAX?

ruby-on-rails ruby ajax jquery

I'm sending info via jQuery AJAX to a post method. Then afterwards I want to redirect to my home page. But redirect_to root_url doesn't work in this scenario. What is the correct way to redirect fr...

Implementing user defined display order UI

c# visual-studio-2005

i have a list of products that are being displayed in particular order. store admin can reassign the display order, by moving the "hot" items to the top of the list. what's the best way of implemen...