Zendcasts Forum

A community of developers who work with the Zend Framework and other enterprise PHP technologies

You are not logged in.

#1 2010-07-14 06:46:06

ashinaidu
New member
Registered: 2010-07-13
Posts: 3

Zend_form View: Want to fetch only firstname Text box

Hi All,

I have studied the zend_form tutorial. In tutorial its mentioned that in the view, we can call to $this->form and the form will get display. All Element we can add in the application/form/formfile. If we need to form element properly we need to use form decorator so that all the element gets display in view in proper place.

Other method its mentioned that we can call individual form element in the view it self. Since I am new to zend I preferred to use the second one i.e. calling individual element in the view. When i said $this->form->getLabel('firstname') , displayed the label but when i say $this->form->getElement('firstname') its displaying label and text box both. I require only Text box because i am calling label properly

How do i fetch only firstname text input?


Here is my code in forms/signin.php

        $firstname = $this->createElement('text','firstname');
        $firstname->setLabel('Enter FirstName')
                ->setAttrib('size',50);

$this->addElements(array(
        $firstname,
       );

Here is my code in controller

$form = new Application_Form_Signin();
$this->view->form = $form;

Regards,
Ash

Offline

Board footer

Powered by FluxBB