title: Symfony 2 - Adding error to form element on preSubmit event subscriber
body: <p>I have a preSubmit event in an event subscriber for a form, and for a specific case I want to add an error to a form field. My method within the subscriber is as follows:</p>
  
  <pre><code>public function onPreSubmit(FormEvent $event)
  
  { 
    $sourceData = $event-&gt;getData();
    $form       = $event-&gt;getForm();
    $identifier = &amp;$sourceData['identifier'];
  
    if ($identifier) {
  
      if ($this-&gt;identifierIsUrl($identifier)) {
        $parser     = $this-&gt;getIdParser();
        $identifier = $parser-&gt;getIdentifier($identifier);
  
        if (is_null($identifier)) {
          $form-&gt;get('identifier')-&gt;addError(new FormError('You have either entered an incorrect url for the source or it could not be parsed'));
        }
      }
  
      $event-&gt;setData($sourceData);
      }    
  }
  </code></pre>
  
  <p>However when I print the form error in the view, it is empty. Is it possible to do this in a preSubmit event? Am I looking at this the wrong way?</p>