Programming Tips

Position Drupal Captcha Module To Be Above Submit Button

By default, the Drupal Captcha Module will try to guess the position of your form’s submit button, then apply a weight that is less than its weight (submits normally have a 30 weight) so that it appears just before your submit button, as is the web standard.

Since there is no administrative option to change where the captcha appears, we must modify the module files to position it before the final submit button.

Navigate to the module folder for your version of the Captcha Module, then find the module file captcha.module. Once in this file, navigate to the function called captcha_pre_render_place_captcha() (try “finding it” with CTRL/CMD – F). Locate the following code:


Assign it a weight of 29.

Voila — your captcha should now be appearing right above the last submit button!

Leave a Reply

Allen Gingrich

Author Allen Gingrich

Allen has worked on the web for over a dozen years. Like many young entrepreneurs, he began with a small workspace in his basement, where he eventually formed Ideas and Pixels. The rest, well, is history. Allen enjoys fine wines, weight training, and beautiful, semantic code.

More posts by Allen Gingrich

Leave a Reply