title: zendframework form2 how to set a value in a hidden form element l
body: <p>quick question.</p>
  
  <p>i am trying to set a value in a hidden form element. this is what i did below;but its not working. </p>
  
  <p>i am trying to add the value 7 to the hidden form field. i used the value options field. but its not working.</p>
  
  <pre><code>    $this-&gt;add(array(
          'type' =&gt; 'Zend\Form\Element\Hidden',
          'name' =&gt; 'id',
          'options' =&gt; array(
              'value_options' =&gt; array(
                  'id'=&gt; 7 ,
        ),  ),
  
      ));
  </code></pre>
  
  <p><strong>below is my form page:</strong></p>
  
  <pre><code>namespace Workers\Form\Fieldset;
  
  
  use Doctrine\Common\Persistence\ObjectManager;
  use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;
  use Zend\Form\Fieldset;
  use Zend\InputFilter\InputFilterProviderInterface;
  
  class JobSortFieldset extends Fieldset implements InputFilterProviderInterface
  {
      public function __construct(ObjectManager $objectManager, $id   )
      {
          parent::__construct('JobSort');
  
  
  
          $this-&gt;setHydrator(new DoctrineHydrator($objectManager, 'Workers\Entity\JobSort'))
               -&gt;setObject(new JobSort());
  
  
          $this-&gt;add(array(
              'type' =&gt; 'Zend\Form\Element\Hidden',
              'name' =&gt; 'id',
              'options' =&gt; array(
                  'value_options' =&gt; array(
                      'id'=&gt; 7 ,
            ),  ),
  
          ));
  </code></pre>