title: set form data with session value without submit this symfony form
body: <p>Hi everybody symfonistes,</p>
  
  <p>I would like to use symfony's form in the web page for search data and when those data are validated I use a table with pagination system for viewing that in the same webpage where the form is.</p>
  
  <p>My webpage runs correctly with search engine and pagination system table but just one thing not run. When I click a button for system pagination (sort, page number or number of viewing per page) a request is send to the controller and at this moment I LOST MY DATA CHOICE FORM.</p>
  
  <p>The result of system pagination is good and relative to previous search but the data form disappear. That way the user can use my webpage but he doesn't look which parameters for the result.</p>
  
  <p>I would like to use session for rebuild my form with data defined previously. at this moment I use preferred_choices in my form class (not run) but if you have another solving you welcome.</p>
  
  <p>Or can you tell me why my form preferred_choices not run ?</p>
  
  <p>Thank a lot for your support</p>
  
  <p>my form class :</p>
  
  <pre><code>class CqsProSansMarqueType extends AbstractType
  {
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $defaultCQSsearch = new CqsProSansMarque();
      ladybug_dump($options['attr']);
      $defaultCQSsearch-&gt;setRayLibelle((!array_key_exists('ray_libelle',     $options['attr'])) ? null : $options['attr']['ray_libelle']);
      $defaultCQSsearch-&gt;setFamLibelle((!array_key_exists('fam_libelle', $options['attr'])) ? null : $options['attr']['fam_libelle']);
      $defaultCQSsearch-&gt;setCaeLibelle((!array_key_exists('cae_libelle', $options['attr'])) ? null : $options['attr']['cae_libelle']);
  
      ladybug_dump($defaultCQSsearch);
  
      $builder
          -&gt;add('ray_libelle', 'entity', array(
              'class' =&gt; 'ApplicationDriveBundle:CqsProSansMarque',
              'property' =&gt; 'ray_libelle',
              'query_builder' =&gt; function(CqsProSansMarqueRepository $er){
                  return $er-&gt;createQueryBuilder('a')
                  -&gt;select('a')
                  -&gt;groupBy('a.ray_libelle');
              },
              'preferred_choices' =&gt; array($defaultCQSsearch),
              'label' =&gt; 'rayon',
              'required' =&gt; false,
          ))
          -&gt;add('fam_libelle', 'entity', array(
              'class' =&gt; 'ApplicationDriveBundle:CqsProSansMarque',
              'property' =&gt; 'fam_libelle',
              'query_builder' =&gt; function(CqsProSansMarqueRepository $er){
                      return $er-&gt;createQueryBuilder('a')
                          -&gt;select('a')
                          -&gt;groupBy('a.fam_libelle');
                  },
              'label' =&gt; 'famille',
              'required' =&gt; false,
          ))
  
      ;
  }
  
  public function setDefaultOptions(OptionsResolverInterface $resolver)
  {
      $resolver-&gt;setDefaults(array(
          'data_class' =&gt; 'Application\DriveBundle\Entity\CqsProSansMarque',
      ));
  }
  
  public function getName()
  {
      return 'CqsProSansMarque';
  }
  </code></pre>
  
  <p>}</p>
  
  <p>my controller construct's form : </p>
  
  <pre><code>            $searchForm2 = $this-&gt;createForm(new CqsProSansMarqueType(), $CqsProSansMarque, array(
              'action' =&gt; $this-&gt;generateUrl('QualityPage_proSansMarque_search', array('maxItemsPerPage' =&gt; $maxItemsPerPage)),
              'method' =&gt; 'POST',
              'attr'   =&gt;  array('ray_libelle' =&gt; $CqsProSansMarque-&gt;getRayLibelle()),
          ));
  </code></pre>
  
  <p>I tested my $defaultCQSsearch variable. It seems to be good setted.</p>