title: How to set attribute (id) at collection fieldset (doctrine 2, zend framework 2)
body: <p>is it possible to set an id at a fieldset that's made by a collection? I've a couple of entities (user, addresses, attachments etc.), and in my user-entity i've several fieldsets that are made with a collection. So a user can have multiple addresses or attachments. My collections are build up like this:</p>
  
  <pre><code>$addressFieldset = new AddressFieldset($serviceManager);
  
  $this-&gt;add(array(
     'type' =&gt; 'Zend\Form\Element\Collection',
     'name' =&gt; 'addresses',
     'options' =&gt; array(
         'label' =&gt; 'Choose address for user',
         'count' =&gt; 1,
         'should_create_template' =&gt; true,
         //'template_placeholder' =&gt; '__placeholder__',
         'allow_add' =&gt; true,
         'target_element' =&gt; $addressFieldset
         ),
     ));
  
  $this-&gt;add(array(
       'name' =&gt; 'addAddress',
       'type' =&gt; 'button',
       'options' =&gt; array('label' =&gt; 'Add Address',
              ),
        ));
  $this-&gt;get('addAddress')-&gt;setAttribute('onclick', 'return add_address()');
  </code></pre>
  
  <p>My problem is that I've multiple collections in my userfieldset. So when I want dynamically add some addresses (example that I use: <a href="http://zf2.readthedocs.org/en/latest/modules/zend.form.collections.html" rel="nofollow">http://zf2.readthedocs.org/en/latest/modules/zend.form.collections.html</a>), the example has the following javascript:</p>
  
  <pre><code>function add_address() {
      var currentCount = $('form &gt; fieldset &gt; fieldset').length;
      var template = $('form &gt; fieldset &gt; span').data('template');
  
      template = template.replace(/__index__/g, currentCount);
  
      $('form &gt; fieldset').append(template);
  
      return false;
  }
  </code></pre>
  
  <p>But, my problem is that if I use the example, it added addressfieldsets also under the attachments. What I want is something like:</p>
  
  <pre><code>function add_address() {
      var currentCount = $('form &gt; #addressFieldset &gt; fieldset').length;
      var template = $('form &gt; #addressFieldset &gt; span').data('template');
  
      template = template.replace(/__index__/g, currentCount);
  
      $('form &gt; #addressFieldset').append(template);
  
      return false;
  }
  </code></pre>
  
  <p>With this, I only access the addressFieldset, but how can I set an ID at the AddressFieldset?
  My tree should look like:</p>
  
  <pre><code>&lt;form&gt;
      &lt;fieldset id="addressFieldset"&gt;
          &lt;legend&gt;Choose addresses&lt;/legend&gt;
          &lt;fieldset&gt;
              //Data
          &lt;/fieldset&gt;
      &lt;/fieldset&gt;
      &lt;fieldset id="attachmentFieldset"&gt;
          &lt;legend&gt;Choose attachments&lt;/legend&gt;
          &lt;fieldset&gt;
              //Data
          &lt;/fieldset&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I don't know how to set the id's in the fieldsets. Please help</p>