How to move captcha fieldset I am using the Captcha module to protect my site against spam. 

I have put everything else on my form inside a fieldset which is collapsible by default. Howeve, the captcha fieldset is the only thing being output last and outside of the fieldset. Using hook_form_alter and dsm($form) I cannot see the captcha fieldset so i'm guessing it's not part of the form??

after scouring through the code i have discovered it's created via a theme function (theme_captcha) which I can override inside my template.php.

I would like to know how can I bring this fieldset inside the form just above it? Look at the screenshot attached.



Thanks
Use hook_form_alter to hook into the form and programmatically insert the captcha element or adjust the weight of the element or pur the element inside the fieldset. 

function example_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if($form_id == 'YOUR_FORM_ID') {
    // 1. Put the captcha element inside the fieldset 

    // OR

    // 2. Associate the capthca element to the form 
    //$form['captcha'] = array(
    //'#type' =&gt; 'captcha',
    //'#captcha_type' =&gt; 'image_captcha/Image',
    //);

    // OR

    // 3. Adjust the #weight attribute in the form 
  }
}


References 

FORM API

How to add a CAPTCHA programmatically

If you need more details please let me have the $form variable in txt format.