title: Zend Framework Custom Forms with viewScript
body: <p>I am having some problems working out how to use custom forms in Zend Framework.</p>
  
  <p>I have followed various guides but none seem to work. Nothing at all gets rendered.</p>
  
  <p>Here is the bits of code that I am trying to use (All code below is in the default module). I have simplified the code to a single input for the test.</p>
  
  <p>applications/forms/One/Nametest.php</p>
  
  <pre><code>class Application_Form_One_Nametest extends Zend_Form {
  
      public function init() {
  
          $this-&gt;setMethod('post');
  
          $name = new Zend_Form_Element_Text('name');
          $name-&gt;setLabel('Box Name')
                  -&gt;setRequired(true)
                  -&gt;addFilter('StripTags')
                  -&gt;addFilter('StringTrim')
                  -&gt;addValidator('NotEmpty');
  
          $submit = new Zend_Form_Element_Submit('submit');
          $submit-&gt;setLabel('Submit Message');
          $submit-&gt;setAttrib('id', 'submitbutton');
          $submit-&gt;setAttrib('class', 'bluebutton');
  
          $this-&gt;addElements(array($name, $submit));
      }
  
  }
  </code></pre>
  
  <p>application/views/scripts/one/formlayout.phtml</p>
  
  <pre><code>&lt;form action="&lt;?= $this-&gt;escape($this-&gt;form-&gt;getAction()) ?&gt;" method="&lt;?= $this-&gt;escape($this-&gt;form-&gt;getMethod()) ?&gt;"&gt;
  
      &lt;p&gt;
          Please provide us the following information so we can know more about
          you.
      &lt;/p&gt;
  
      &lt;? echo $this-&gt;element-&gt;name ?&gt;
      &lt;? echo $this-&gt;element-&gt;submit ?&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>application/controllers/IndexController.php</p>
  
  <pre><code>public function formtestAction() {
      $form = new Application_Form_One_Nametest();
      $form-&gt;setDecorators(array(array('ViewScript', array('viewScript' =&gt; 'one/formlayout.phtml'))));
  
      $this-&gt;view-&gt;form = $form;
  }
  </code></pre>
  
  <p>application/views/scripts/index/formtest.phtml</p>
  
  <pre><code>&lt;h1&gt;Formtest&lt;/h1&gt;
  &lt;?
  echo $this-&gt;form;       
  ?&gt;
  </code></pre>
  
  <p>The above code does not throw any errors or render any part of formlayout.phtml including the form tags or text between the p tags.</p>
  
  <p>Can anybody tell me what I might be doing wrong?</p>