title: SYMFONY FORM EVENT -> Change submitted data on PRE SUBMIT event? / Have field with attribute `disabled:true` NOT EMPTY after the SUBMIT
body: <p>My goal: I have a SYMFONY FORM with a field that should be <code>disabled:true</code>. When the form is submited the field with attribute <code>disabled:true</code> is not sent in the form and <strong>hence it doesn't appear on the form after a successful submit (value is empty in the field)</strong>.</p>
  
  <p>I read that I could use the <code>readonly:true</code> attribute instead but it is not a real fit (I like my read only being identified on the screen with grey background).</p>
  
  <p>So I went to SYMFONY FORM EVENTS: I did some reading thru and change MyEntityType Class as such:</p>
  
  <pre><code>class MyEntityType extends AbstractType {
     public function buildForm(FormBuilderInterface $builder, array $options){
  
           $builder&gt;add('....',....,array(...));
           $builder&gt;add('email',EmailType::class,array('attr'=&gt;array('disabled'=&gt;true,'readonly'=&gt;true)));
           $builder-&gt;add('submit',SubmitType::class,array('label'=&gt;'Submit'));
  
           $builder-&gt;addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event){
                $formToAlter = $event-&gt;getForm();
                $viewData = $event-&gt;getForm()-&gt;getViewData();
                $data = $event-&gt;getData();
                dump($event);
                dump($viewData);
                dump($data);
                $formToAlter-&gt;add('email',EmailType::class,array('attr'=&gt;array('readonly'=&gt;true,'data'=&gt;$viewData-&gt;getEmail())));
               });
  
        }
  
  ...other AbstractType functions...
  
  }
  </code></pre>
  
  <p>There is a bit of experiment in the Listener function binded to the PRE_SUBMIT event.</p>
  
  <p>I thought that I could, on the PRE_SUBMIT event, take away the <code>disabled:true</code> attribute and have the value in the field EMAIL going thru the FORM so as to have the field EMAIL appearing filled out again with my original value after all the SUBMIT process had been over.  </p>
  
  <p>What I noticed is that, <code>$event-&gt;getData()</code> is an array of the SUBMITED fields of the form, so, at that point (in the PRE_SUBMIT event), in that array I cannot find my EMAIL, it has already been discarded because that field had the attribute <code>disabled:true</code>. I thougth maybe I could change the array values of <code>$event-&gt;getData()</code> to force the integration of the value being in the field showed with <code>disabled:true</code>, but I don't know how to do that.</p>
  
  <p>I've also try to act on the POST_SET_DATA event like:</p>
  
  <pre><code>  $builder-&gt;addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event){
        $formToAlter = $event-&gt;getForm();
        $formToAlter-&gt;add('email',EmailType::class,array('attr'=&gt;array('readonly'=&gt;true)));
    });
  </code></pre>
  
  <p>But it does display the field EMAIL with no attribute <code>disabled:true</code>  before the SUBMIT.</p>
  
  <p>Hence I don't know because <strong>POST_SET_DATA seems too early and PRE_SUBMIT seems to late to have control over what I want</strong>.</p>
  
  <p>Does anyone have a clue?</p>