title: How to customize the data-prototype attribute in Symfony 2 forms
body: <p>Since umpteens days, I block on a problem with Symfony 2 and forms.</p>
  
  <p>I got a form of websites entities. "Websites" is a collection of website's entities and each website contains two attributes : "type" and "url".</p>
  
  <p>If I want to add more of one website in my database, I can click on a "Add another website" link, which add another website row to my form. So when you click on the submit button, you can add one or X website(s) at the same time.</p>
  
  <p>This process to add a row use the data-prototype attribute, which can generate the website sub-form.</p>
  
  <p>The problem is that I customize my form to have a great graphic rendering... like that :</p>
  
  <pre><code>&lt;div class="informations_widget"&gt;{{ form_widget(website.type.code) }}&lt;/div&gt;
  &lt;div class="informations_error"&gt;{{ form_errors(website.type) }}&lt;/div&gt;
  &lt;div class="informations_widget"&gt;{{ form_widget(website.url) }}&lt;/div&gt;
  &lt;div class="informations_error"&gt;{{ form_errors(website.url) }}&lt;/div&gt;
  </code></pre>
  
  <p>But the data-prototype doesn't care about this customization, with HTML and CSS tags &amp; properties. I keep the Symfony rendering : </p>
  
  <pre><code>&lt;div&gt;
  &lt;label class=" required"&gt;$$name$$&lt;/label&gt;
  &lt;div id="jobcast_profilebundle_websitestype_websites_$$name$$"&gt;
  &lt;div&gt;
  &lt;label class=" required"&gt;Type&lt;/label&gt;
  &lt;div id="jobcast_profilebundle_websitestype_websites_$$name$$_type"&gt;
  &lt;div&gt;
  &lt;label for="jobcast_profilebundle_websitestype_websites_$$name$$_type_code" class=" required"&gt;label&lt;/label&gt;
  &lt;select id="jobcast_profilebundle_websitestype_websites_$$name$$_type_code" name="jobcast_profilebundle_websitestype[websites][$$name$$][type][code]" required="required"&gt;
  &lt;option value="WEB-OTHER"&gt;Autre&lt;/option&gt;
  &lt;option value="WEB-RSS"&gt;Flux RSS&lt;/option&gt;
  ...
  &lt;/select&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;div&gt;
  &lt;label for="jobcast_profilebundle_websitestype_websites_$$name$$_url" class=" required"&gt;Adresse&lt;/label&gt;
  &lt;input  type="url" id="jobcast_profilebundle_websitestype_websites_$$name$$_url" name="jobcast_profilebundle_websitestype[websites][$$name$$][url]" required="required" value="" /&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Does anyone have an idea to make that hack ?</p>