title: I want to customise the markup of zend form
body: <p>I have a form and I would like to customise the markup for it.  Im using the decorators at the bottom of the class. However, I keep getting the error:</p>
  
  <p>Exception caught by form: No file decorator found.</p>
  
  <p>I was wondering if someone would be able to show me an example.  I basically want to output the form as  and do away with the standard layout.  Maybe add a few custom classes also.</p>
  
  <p><strong>Updated</strong>
      
  
  <pre><code>class Application_Form_Admin extends Zend_Form
  {
  
      public function init()
      {
          // Set the method for the display form to POST
          $this-&gt;setMethod('post');
  
          // set the data format
          $this-&gt;setAttrib('enctype', 'multipart/form-data');
  
          // Add the entry id
          $this-&gt;addElement('hidden', 'id', array(
              'required'   =&gt; false
          ));
  
          // Add the title
          $this-&gt;addElement('text', 'title', array(
              'label'      =&gt; 'Project Title',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the title
          $this-&gt;addElement('text', 'appid', array(
              'label'      =&gt; 'App Id',
              'required'   =&gt; true,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the title
          $this-&gt;addElement('text', 'appsecret', array(
              'label'      =&gt; 'App Secret',
              'required'   =&gt; true,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the title
          $this-&gt;addElement('text', 'namespace', array(
              'label'      =&gt; 'Namespace',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the title
          $this-&gt;addElement('text', 'applink', array(
              'label'      =&gt; 'App Link',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 255))
                  )
          ));
  
          // Facebook Only?
          $this-&gt;addElement('checkbox', 'fbonly', array(
              'label'      =&gt; 'Facebook Only',
              'required'   =&gt; false,
              'value'      =&gt; 1
          ));
  
          // general app data group
          $this-&gt;addDisplayGroup(array('title', 'appid', 'appsecret', 'namespace', 'applink', 'fbonly'), 'general', array('legend' =&gt; 'General Optons'));
  
          // Facebook Only?
          $this-&gt;addElement('checkbox', 'fangate', array(
              'label'      =&gt; 'Fangate Page',
              'required'   =&gt; false,
              'value'      =&gt; 1
          ));
  
          // Facebook Only?
          $this-&gt;addElement('checkbox', 'welcome', array(
              'label'      =&gt; 'Welcome Page',
              'required'   =&gt; false,
              'value'      =&gt; 1
          ));
  
          // Facebook Only?
          $this-&gt;addElement('checkbox', 'help', array(
              'label'      =&gt; 'Help Page',
              'required'   =&gt; false,
              'value'      =&gt; 1
          ));
  
          // Facebook Only?
          $this-&gt;addElement('checkbox', 'entries', array(
              'label'      =&gt; 'Entries Page',
              'required'   =&gt; false,
              'value'      =&gt; 1
          ));
  
          // pages enabled group
          $this-&gt;addDisplayGroup(array('fangate', 'welcome', 'help', 'entries'), 'page', array('legend' =&gt; 'Page Optons'));
  
          // Add the title
          $this-&gt;addElement('text', 'ogtype', array(
              'label'      =&gt; 'Default Open Graph Type',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the title
          $this-&gt;addElement('text', 'ogtitle', array(
              'label'      =&gt; 'Default Open Graph Title',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the title
          $this-&gt;addElement('text', 'ogdesc', array(
              'label'      =&gt; 'Default Open Graph Description',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the title
          $this-&gt;addElement('file', 'ogimage', array(
              'label'      =&gt; 'Default App Image',
              'required'   =&gt; false
          ));
  
          // generic open graph data
          $this-&gt;addDisplayGroup(array('ogtype', 'ogtitle', 'ogdesc', 'ogimage'), 'og', array('legend' =&gt; 'Generic Open Graph data'));
  
          // Add the wall title
          $this-&gt;addElement('text', 'apptitle', array(
              'label'      =&gt; 'App Title',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the wall caption
          $this-&gt;addElement('text', 'appcaption', array(
              'label'      =&gt; 'App Caption',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 60))
                  )
          ));
  
          // Add the wall message
          $this-&gt;addElement('text', 'appdesc', array(
              'label'      =&gt; 'App Description',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 255))
                  )
          ));
  
          // app message details
          $this-&gt;addDisplayGroup(array('apptitle', 'appcaption', 'appdesc'), 'appdetails', array('legend' =&gt; 'App deatils (Used when sharing)'));
  
          // Add the wall title
          $this-&gt;addElement('text', 'wallmsg', array(
              'label'      =&gt; 'Wall Message',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 255))
                  )
          ));
  
          // Add the wall title
          $this-&gt;addElement('text', 'friendmsg', array(
              'label'      =&gt; 'Friends Wall Message',
              'required'   =&gt; false,
              'validators' =&gt; array(
                      array('validator' =&gt; 'StringLength', 'options' =&gt; array(0, 255))
                  )
          ));
  
          // app message details
          $this-&gt;addDisplayGroup(array('wallmsg', 'friendmsg'), 'wallmessages', array('legend' =&gt; 'Wall post messages'));
  
          // Add the submit button
          $this-&gt;addElement('submit', 'submit', array(
              'ignore'   =&gt; true,
              'label'    =&gt; 'Submit',
          ));
  
          // And finally add some CSRF protection
          $this-&gt;addElement('hash', 'csrf', array(
              'ignore' =&gt; true,
          ));
  
          // change markup of elements
          $this-&gt;setElementDecorators(array(
              'ViewHelper',
              array(
                  'Description',
                  array(
                      'tag'    =&gt; 'div',
                      'class'  =&gt; 'submit-button',
                      'escape' =&gt; false
                  )
              ),
              array(
                  array(
                      'data' =&gt; 'HtmlTag'
                  ),
                  array(
                      'tag'   =&gt; 'span',
                      'class' =&gt; 'element'
                  )
              ),
              array(
                  'Label',
                  array(
                      'tag'    =&gt; 'label',
                      'class' =&gt; 'elementLabel',
                      'escape' =&gt; false
                  )
              ),
              'File',
              array(
                  array(
                      'data' =&gt; 'HtmlTag'
                  ),
                  array(
                      'tag'   =&gt; 'span',
                      'class' =&gt; 'element'
                  )
              ),
              array(
                  array(
                      'row' =&gt; 'HtmlTag'
                  ),
                  array(
                      'tag'   =&gt; 'li',
                      'class' =&gt; 'element-row'
                  ),
              ),
              'Errors'
          ));
  
          // change markup of form
          $this-&gt;setDecorators(array(
              'FormElements',
              array(
                  'HtmlTag',
                  array(
                      'tag' =&gt; 'div',
                      'id'  =&gt; $this-&gt;_containerId
                  )
              ),
              'Form',
              'Errors'
          ));
  
      }
  
  
  }
  </code></pre>