title: Creating a form view in Zend
body: <p>Is there a reliable way to create a custom view for a <code>Zend_Form</code>? The decorators are pretty cryptic and using them in fancy ways sometimes is so complicated that I'd prefer to just write the HTML by hand. Is there a way to do it and still make the form fully cooperate with the controller (eg. call <code>$form-&gt;isValid()</code> and expect everything to validate properly)? If so, are there any caveats to look out for (like taking care about validation errors display)?</p>
  
  <p>The ideal solution would be to create a form and pass the elements array (containing the necessary data like names, IDs, input types and all needed to render the HTML) - does Zend Framework permit this?</p>
  
  <p>[EDIT]</p>
  
  <p>Instead of just <code>echo</code>ing the form object, I have tried adding this code in the view (a simple login form):</p>
  
  <pre><code>&lt;?php
  $userid = $this-&gt;form-&gt;getElement('userid');
  $pass = $this-&gt;form-&gt;getElement('password');
  $remember = $this-&gt;form-&gt;getElement('remember');
  $submit = $this-&gt;form-&gt;getElement('submit');
  ?&gt;
  &lt;form enctype="&lt;?php echo $this-&gt;form-&gt;getEnctype(); ?&gt;" method="&lt;?php echo $this-&gt;form-&gt;getMethod(); ?&gt;" action="&lt;?php echo $this-&gt;form-&gt;getAction(); ?&gt;" id="&lt;?php echo $this-&gt;form-&gt;getId(); ?&gt;"&gt;
  name: &lt;input type="text" id="&lt;?php echo $userid-&gt;getId(); ?&gt;" name="&lt;?php echo $userid-&gt;getName(); ?&gt;" /&gt;&lt;br /&gt;
  pass: &lt;input type="password" id="&lt;?php echo $pass-&gt;getId(); ?&gt;" name="&lt;?php echo $pass-&gt;getName(); ?&gt;" /&gt;&lt;br /&gt;
  remember: &lt;input type="checkbox" id="&lt;?php echo $remember-&gt;getId(); ?&gt;" name="&lt;?php echo $remember-&gt;getName(); ?&gt;" /&gt;&lt;br /&gt;
  submit: &lt;input type="submit" id="&lt;?php echo $submit-&gt;getId(); ?&gt;" name="&lt;?php echo $submit-&gt;getName(); ?&gt;" value="&lt;?php echo $submit-&gt;getValue(); ?&gt;" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The form seems to work OK and validate (although I don't get redirected the the page I came from - but that's a different problem, I believe, as I pass that via <code>GET</code>, not in the form). Is that acceptable, or am I doing something horridly wrong without knowing it?</p>