radios options separated into different wrappers I'm trying to customize a radios field to wrap some of the options into a div.

What the best way to do it?

I had a look to theme_radio but no success on it :(
example:

&lt;div id="part1"&gt;
  &lt;div class="form-item form-type-radio form-item-SOME_ID"&gt;
    &lt;input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" /&gt; 
    &lt;label class="option" for="edit-bla-bla"&gt;MY LABEL&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-SOME_ID"&gt;
    &lt;input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" /&gt; 
    &lt;label class="option" for="edit-bla-bla"&gt;MY LABEL&lt;/label&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div id="part2"&gt;
  &lt;div class="form-item form-type-radio form-item-SOME_ID"&gt;
    &lt;input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" /&gt; 
    &lt;label class="option" for="edit-bla-bla"&gt;MY LABEL&lt;/label&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div id="part3"&gt;
  &lt;div class="form-item form-type-radio form-item-SOME_ID"&gt;
    &lt;input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" /&gt; 
    &lt;label class="option" for="edit-bla-bla"&gt;MY LABEL&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-SOME_ID"&gt;
    &lt;input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" /&gt; 
    &lt;label class="option" for="edit-bla-bla"&gt;MY LABEL&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-SOME_ID"&gt;
    &lt;input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" /&gt; 
    &lt;label class="option" for="edit-bla-bla"&gt;MY LABEL&lt;/label&gt;
  &lt;/div&gt;
&lt;/div&gt;


ANSWER:

See Djouuuuh answers + 

$output .= drupal_render($element['element'][$i]);


if you do this one below it won't work with ajax...

$output .= theme('radio', $element['element'][$i]);
In my opinion you can achieve that with a theme function, specified like this:

$element['example'] = array(
  '#type' =&gt; 'checkboxes',
  '#title' =&gt; t('Example checkboxes'),
  '#options' =&gt; $options,
  '#theme' =&gt; array('custom_options'),
);


And then, you can write down the output just as you want here:

function theme_custom_options($element) {
  $output = '&lt;div id="blah"&gt;';
  $output .= $element['#options'][0];
  $output .= $element['#options'][1];
  $output .= '&lt;/div&gt;&lt;div id="blablah"&gt;';
  $output .= $element['#options'][2];
  $output .= $element['#options'][3];
  $output .= '&lt;/div&gt;';
  // ETC...
  return $output;
}


Does it seem correct?