title: Is it possible to have a display only fieldtype in Symfony2?
body: <p>I want to have display-only fields to render data that's never going to be changed nor submitted.</p>
  
  <p>Similar to <a href="http://getbootstrap.com/css/#forms-controls-static" rel="nofollow noreferrer">bootstrap's static controls</a>.</p>
  
  <p>I need to show object data within a form without breaking the form structure or style. I want this data to use the same templates as all other inputs, but without rendering it as a dynamic input.</p>
  
  <p>I thought of several ways to achieve this, some are plain hacks, some others seem more legitimate, but I wan't to know if there is a more standard way to do this.</p>
  
  <p>Here's the list of options I have thought of in no particular order:</p>
  
  <ol>
  <li><p>Use the read only property for fields: it does not feel very nice, I don't want users to feel they can change something, but they are not allowed for some reason.</p></li>
  <li><p>Hack the templates to output something other than input elements: seems very nasty to me, besides it would be necessary to handle server side the the missing fields on submits.</p></li>
  <li><p>Extending field types to create display-only versions of them. I don't think this would be safe.</p></li>
  <li><p>Writing a custom fieldType to do the job. This option would be good to use as a base type for other fields.</p></li>
  </ol>
  
  <p>I think the best solution is either option 3 or 4.
  The only thing I still haven't found is how to handle the missing fields on submit.</p>
  
  <p>I think it's important to have this type of fields because it allows reusing form types logic. Otherwise I end up writing twig templates that look like this:</p>
  
  <pre><code>&lt;form&gt;
  
      {# This is the average writtable field #}
      {{ form_row(form.field1) }} 
  
      {# This is the display-only field, notice I have to replicate
         markup. Even if I wrote a macro, which I did, I would still
         have to replicate markup in the macro.
      #}
      &lt;label&gt;Field 2&lt;/label&gt;
      &lt;div&gt;{{ the_object.field2 }}&lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>And finally, does anyone have a better idea or think that this approach is flawed altogether?</p>