Heine

  • home
  • drupal
  • about
Home › Forums › MyCaptcha › Bug reports

captcha shows up after submit button

Anonymous — Mon, 11/06/2007 - 00:08

Another issue with the drupal contact form.

The catpcha image and input field show up after the "Send e-mail" button.

Average: 3.2 (169 votes)
Error message "The answer to the captcha was incorrect." too geeky ›
  • Bug reports
  • Login to post comments

Duplicate of

Heine — Mon, 11/06/2007 - 07:22

Duplicate of http://heine.familiedeelstra.com/node/37.

The issue here is that the contact form submit button doesn't have a weight. It is clear that MyCaptcha needs to solve this a bit more intelligently.

In the mean time you can fix Captcha appearance on the contact form in your theme: Create or add to the file template.php (minus <?php ?> tags):

function phptemplate_contact_mail_page($form) {
  $button = drupal_render($form['submit']);
  return drupal_render($form) . $button;
}

  • Login to post comments

Works great!

colorado — Mon, 11/06/2007 - 12:11

Thank you so much - this fix works!

I just added more instances of that code for the other MyCaptchas on my sites (i.e. I have the Postcard module on one of my sites), changing contact_mail_page to the name of the form (i.e. postcard_create_form).

  • Login to post comments

Another example

Heine — Wed, 20/06/2007 - 22:50

You are welcome.

Some forms need a slightly different treatment as their submit button is named differently (internally). This is the case for guestbook for example:

function phptemplate_guestbook_form_entry_form($form) {
//function theme_guestbook_form_entry_form($form) {
  $output = '';
  $access = $form['access']['#value'];
  $display = $form['display']['#value'];
  $uid = $form['uid']['#value'];
 
  switch ($access) {
    case 'allowed':
      if ($display == 'link') {
        // output only a link to a page with the form
        $output .= '<p>» '. l(t('Add guestbook entry'), "guestbook/$uid/form") .'</p>';
      }
      else {
        $output .= $display == 'page' ? '' : '<h3>'. t('Add guestbook entry') .'</h3>';
// CHANGED:
        $button = drupal_render($form['send']);        
        $output .= drupal_render($form) . $button;
      }
      break;
    case 'own guestbook':
      $output .= ' ';    
      break;
    case 'not logged in':
      $output .= '<p class="links">» '. t('You must be logged in to post a comment.') .'</p>';
      break;  
    case 'not allowed':
      $output .= '<p class="links">» '. t('You are not allowed to post in this guestbook.') .'</p>';
      break;  
  }
  return $output;
}

  • Login to post comments

into documention you go!

drozzy (not verified) — Wed, 21/05/2008 - 20:43

This neat trick should really be mentioned in the documentation!
This is the second time I stumble across this (first time I didn't solve it :-)

Great module!

  • Login to post comments

Recent posts

  • In doubt? Read the specs!
  • About the Webform SA
  • Psalmen voor Altblokfluit
  • Unserializing user-supplied data, a bad idea
  • Planet Drupal past and current
more

Security reviews

  • Afraid custom code makes your site vulnerable?
  • You don't really trust that module you just downloaded from Drupal.org?

Sleep better after a security review.

Tags

bladmuziek blood donation blood supply CSRF Drupal Input Format modx MSM Performance Planet Drupal Security Varnish
more tags
  • home
  • drupal
  • about

Copyright © 2011 by Heine Deelstra. All rights reserved.