Zend_Form: when print elements of form in view- form tag dod't created

Problem: When print elements of form in view, form tag don't created

My View:

<?php
/****** print elements and inser label:: have to be done in this way for integrate cushycms ********/
echo $this->form->empty;
?>
 <label>Ad Title</label>
 <?php
 echo $this->form->adtitle;
 ?>
<label></label>
 <?php echo $this->form->adbody; ?>

MY Form (part of the code):

class MyForm extends Zend_Form
{
function init(){
   $empty = new Zend_Form_Element_Hidden("empty");
        $empty->removeDecorator('Label');
        $title = new Zend_Form_Element('adtitle');
        $title->removeDecorator('Label');

        $title//->setLabel('Ad Title')
                    ->setRequired('true')
                    ->addFilter('StripTags')
                    ->addFilter('StringTrim')
                    ->addValidator('NotEmpty')
                    ->setAttrib('MAXLENGTH',100)
                    ->setAttrib('Size',106);

        $title->getValidator('NotEmpty')
                    ->setMessage('Company Name can not be empty');

        $body = new Zend_Form_Element_Textarea('adbody');
        $body->removeDecorator('Label');
}
}

The html that I get (form tag not exist):

<dd id="empty-element">
<input type="hidden" name="empty" value="" id="empty"></dd> <label>Ad Title</label>
 <dd id="adtitle-element">
<input type="text" name="adtitle" id="adtitle" value="" MAXLENGTH="100" Size="106"></dd><label></label>

 <dd id="adbody-element">
<textarea name="adbody" id="adbody" onKeyDown="javascript:limitText(this.form.countdown,400)" onKeyUp="javascript:limitText(this.form.countdown,400)" rows="24" cols="80"></textarea></dd> <label>chras left (maximum 400): </label>

Thank you very much

Answers


I think you have to add the form tag by your self.

    <form action="<?= $this->escape($this->form->getAction() ?>"
          method="<?= $this->escape($this->form->getMethod() ?>"
    >

Or use

echo $this->form; 

Need Your Help

Button on PreferenceFragment

android android-fragments

I'm currently working on my PreferenceFragment on which I want to have two buttons which further into the working progress communicate with the Dropbox API to set your login credentials and / or de...

Proper terminology, should I say indexes or indices?

indexing terminology indices

I had a question about indices on a table and I put it up on Stack Overflow. I got my answer, but someone changed the word indices to say indexes.