Hi everybody,
do you know how can i change the weight (position) of the captcha element in my form.
For example I'd like to set one of my form field below the captcha element .

Thanks for the Help!!!!


soxofaan’s picture

Status:Active» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

klikissy’s picture

Status:Closed (fixed)» Needs work

It doesn't seem to work...

pooja.sarvaiye’s picture

@klikissy: in which form are you trying to reorder the Captcha field? Is it some form provided by drupal core or any module or a programmatically created form?

wundo’s picture

Category:feature» support
eugene.ilyin’s picture

Assigned:Unassigned» eugene.ilyin
Issue summary:View changes
artemln’s picture

Assigned:eugene.ilyin» Unassigned
Status:Needs work» Closed (cannot reproduce)

In dev branch 7.x-1.x the problem can not be reproduced.

You can change "#weight" from any form_alter. Simple example for the "registration form":

 *  Implements hook_form_alter().
function custom_form_alter(&$form, &$form_state, $form_id) {
  $form['captcha']['#weight'] = -11;


Also you can define the "captcha" between fields in your custom form. Simple example:

function custom_my_form($form) {
  $form['field_1'] = array(
    '#type' => 'textfield',

  $form['captcha'] = array(
    '#type' => 'captcha',

  $form['field_2'] = array(
    '#type' => 'textfield',

  return $form;