Czy ktoś może mi wyjaśnić czy taki kod jest poprawny ponieważ tworzy mi formularz lecz bez elementów <form></form>
Mam klasę (tylko fragment dla zobrazowania przykładu)
<?php
class User_CreateForm extends Zend_Form
{
public function __construct($options = null)
{
parent::__construct($options);
$this ->setName('createForm')
->setAction('create')
->setAttrib('id', 'publicform');
$username = new Zend_Form_Element_Text('username');
$username ->setLabel('Login:')
->addValidator('NotEmpty')
->setRequired(true);
$email = new Zend_Form_Element_Text('email');
$email ->setLabel('Adres email:')
->addValidator('NotEmpty')
->addValidator('EmailAddress')
->setRequired(true);
$submit = new Zend_Form_Element_Image('submit');
$submit ->setAttrib('class', 'login-btn')
->setAttrib('id', 'login-btn')
->setImage('../public/images/btn.gif');
$this->addElements(array($username, $email, $submit));
$this->addDisplayGroup(array('username', 'email'), 'subForm1st');
$this->setDisplayGroupDecorators( array( 'Form'
));
}
}
?>
W kontrolerze kod wysyłający formularz do szablonu
<?php
$createForm = new User_CreateForm();
$this->view->titlePage = "Rejestracja użytkownika w systemie";
$this->view->titleSection = "Rejestracja";
$this->view->form1 = $createForm->subForm1st;
?>
I wyświetlam wszystko w szablonie
<?php
?>
W wyniku dostaję cały formularz ale niestety bez <form> </form> Czy ja coś robię nie tak?