title: Nesting Fieldsets under Radio or Checkbox items: Zend Framework 2
body: <p>I would like to create a fieldset under each radio/checkbox item.</p>
  
  <p>e.g </p>
  
  <pre><code>Which animals do you like:
  
  [x] Cats
  
      [Fieldset of cat related questions]
  
  [ ] Dogs
  
      [Fieldset of dog related questions]
  </code></pre>
  
  <p>...</p>
  
  <p>I can create Fieldsets and Forms with ease, but nesting them under each item is causing me some headaches. </p>
  
  <p>Ultimately I had in mind something like this:</p>
  
  <pre><code> $this-&gt;add(array(
          'type' =&gt; 'Zend\Form\Element\Radio',
          'name' =&gt; 'profile_type',
          'options' =&gt; array(
              'label' =&gt; 'Which animals do you like:',
              'label_attributes' =&gt; array('class'=&gt;'radio inline'),
              'value_options' =&gt; array(
                  '1' =&gt;'cats',
  
                  'fieldsets' =&gt; array(
                   array(
                      'name' =&gt; 'sender',
                      'elements' =&gt; array(
                          array(
                              'name' =&gt; 'name',
                              'options' =&gt; array(
                                  'label' =&gt; 'Your name',
                                  ),
                              'type'  =&gt; 'Text'
                          ),
                          array(
                              'type' =&gt; 'Zend\Form\Element\Email',
                              'name' =&gt; 'email',
                              'options' =&gt; array(
                                  'label' =&gt; 'Your email address',
                                  ),
                          ),
                      ),
                  )),
                  '2'=&gt;'dogs',
  
                  'fieldsets' =&gt; array(
                      array(
                          'name' =&gt; 'sender',
                          'elements' =&gt; array(
                              array(
                                  'name' =&gt; 'name',
                                  'options' =&gt; array(
                                      'label' =&gt; 'Your name',
                                  ),
                                  'type'  =&gt; 'Text'
                              ),
                              array(
                                  'type' =&gt; 'Zend\Form\Element\Email',
                                  'name' =&gt; 'email',
                                  'options' =&gt; array(
                                      'label' =&gt; 'Your email address',
                                  ),
                              ),
                          ),
                      ))
              ),
          ),
          'attributes' =&gt; array(
              'value' =&gt; '1' //set checked to '1'
          )
      ));
  </code></pre>