Hi,

Why don't you use a view script decorator?

http://framework.zend.com/manual/en/zend.form.standardDecorators.html#zend.form.standardDecorators.viewScript

This way you will still be able to get the fine-grained control your after.

Thanks





2009/11/6 Simeon Goranov <[email protected]>

> Hello,
> I've got this one in my view script index.phtml:
>
> <h2>Log In</h2>
> <p>
> <?php echo $this->form('Default_Form_Login', array('name' =>
> 'form_login', 'id' => 'form_login', 'method' => 'post', 'action' =>
> $this->link('login', 'index')), false); ?>
> Username <br />
> <?php echo $this->formText('form_username');?><br />
> Password <br />
> <?php echo $this->formPassword('form_password');?><br />
> <?php echo $this->formSubmit('Submit', 'Login');?>
> </form>
> </p>
>
>
> The form up is created with the view helpers and I want to "connect"
> this form to one created from the class:
>
> class Default_Form_Login extends Zend_Form
> {
>
>    public function __construct($options=array())
>    {
>        parent::__construct($options);
>
>        $this->setName('form_login');
>        $this->setMethod('post');
>
>        $element = new Zend_Form_Element_Text('form_username');
>        $element->setLabel('Username');
>        $this->addElement($element);
>
>        $element = new Zend_Form_Element_Password('form_password');
>        $element->setLabel('Password');
>        $this->addElement($element);
>
>        $element = new Zend_Form_Element_Submit('Login');
>        $this->addElement($element);
>    }
> }
>
>
> So I will be able to use the form in my action in this way:
>
> public function loginAction()
> {
>    $form = new Default_Form_Login();
>    $result = $form->getValues();
>
> Is it possible and how ?
>
> Regards,
> S.G.
>
>

Reply via email to