Okay, I'm developing a new site and about to hit my wits end on this. Using Drupal Version 6.16 and was using captcha 6.21 but have temporarily gone back to a beta 3 version of 2.0 since someone else had posted this patch that supposedly "fixed" the problem. Having issues with installing patch.

It's very simple and maybe there's an easy way to fix this but I've kind of had it with this issue spending the last two days trying to find the fix. Like I said, it's really simple. How in the heck do I get the captcha window to appear above the "submit" button on my new user registration form/page??????

As far as my experience level here I'm slightly graduating out of the "Newbie" status. I've found other posts, with patches and some php coding kluge or two but most everything has to do with version 4 or 5 of Drupal. I tried a few of the code mods on my template.php file with no success. Captcha and reCaptcha are both functional but the placement on this page is UG.... annoying to say the least.

Anyone know the trick to tweaking this?

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

soxofaan’s picture

Please provide screenshot or better: a link to a live site.

temporarily gone back to a beta 3 version of 2.0 since someone else had posted this patch that supposedly "fixed" the problem

please provide reference (link to patch/discussion)

Normally CAPTCHA module should be able to automatically position the CAPTCHA above the submit button.
What other modules that could interfere with this are you using? What theme are you using?
Is this problem only on the user registration form or also on other forms (e.g. comment form)?

zap-admin’s picture

Took site out of Maint mode.... if you want to see the page it's at http://www.controlmarine.com/user/register ..... and sorry for the earlier boo boo where This post came up 4 times. Went in to delete the extras but someone beat me to the punch there...

zap-admin’s picture

Using Sky as the theme, reCaptcha... but the field was appearing the same w/o reCaptcha installed. The only other thing that comes into this page, or used to, was the MailChimp Module. I originally had that appearing in the 1 page registration form.... but removed it because the Captcha field was grabbing on to that. MailChimp was adding a second button to "update" membership in the newsletters.... this is why I removed it. Anyway, when that was appearing in the main registration with it's "update" button, the captcha field was appearing above that button... and not the main submit button for the whole form.

soxofaan’s picture

I don't know if this is within your comfort/skill zone, but could you try to remove the entry for "captcha_placement_map_cache" from the "variables" table from your database? Maybe this will do the trick?

zap-admin’s picture

Okay..... I'll just be good and backup the database in case I mangle something.....LOL. Will report back in a while. Thanks for your help Steffan.... and for your hard work on this module.

Jeffrey

zap-admin’s picture

Steffan, should I completely remove the entry?.... or should I just delete the value/contents of that field?

Thanks

soxofaan’s picture

completely remove the entry
it's just cache and will be rebuild when not available

zap-admin’s picture

KICK ASS!!

That fixed the problem..... Submit button is now below captcha window...... Finally!....LOL. I should have posted in here to start with...

Thanks again for your help... Do you run the captcha web site?

zap-admin’s picture

Status: Active » Fixed
soxofaan’s picture

Happy that we could hunt this problem down so fast.

(yes I'm the main maintainer of the CAPTCHA module for the moment)

FYI: I made a separate issue (feature request) for making it possible to clear this caching variable through the admin UI: #766190: Flush CAPTCHA placement cache

webdesigncapetown’s picture

Thanks soxofaan. You saved me hours of pulling my hair out.

malclocke’s picture

Status: Fixed » Active

Sorry, don't think this is fixed. I am in the same situation, the difference being I can't just disable the mailchimp module to make the problem go away.

The mailchimp module, and I guess potentially others, add an extra submit button in the middle of the register form. The captcha form is being placed in the middle of this fieldset, because it is placing itself before the first submit button in the form.

The code says:

      // TODO: make this more sofisticated? Use cases needed.
      $placement = $buttons[0];

And I agree. Well, with the sentiment, not the spelling.

I think a common scenario is the final elements in a form are submit buttons, but there can be more than one, and placement should be before the first one of them. So how about the following for the selection logic:

* Starting with the last element, walk backwards through the form until a submit button is found
* Continue walking backwards until an item that isn't a submit button is found
* Place the captcha fieldset after this item

Does that sound sensible?

soxofaan’s picture

The mailchimp module, and I guess potentially others, add an extra submit button in the middle of the register form. The captcha form is being placed in the middle of this fieldset, because it is placing itself before the first submit button in the form.

can you give a screenshot of that? I don't know and never used the mailchimp module.

zap-admin’s picture

Malclocke...... what I ended up doing was completely removing the MailChimp Interface from the registration page. There's an option for this on the Mailchimp control panel (Is that what that is really called???...sorry) You deselect "Show Subscription options on the user registration form" but make sure the "Show Subscription Options on User Edit Screen" is selected. Anyway, it remains part of your users account window when they go there. I set it up for the time being to automatically enroll people in the newsletters. Not the best method I admit, but it will have to work until something is resolved with the way the interface for mailchimp is designed. I sent a request to them but never got a response. The way they designed the module seems to be to function as a standalone interface.

Soxofaan...... I'm attaching an image so you can see what Malclocke is talking about..... below what is shown in this image is the captcha and submit button as where they should be...... Thanks again Soxofan

zap-admin’s picture

Added an image to my last post so you can see what Malclocke is talking about..... Thanks again for your help.

webadpro’s picture

Hi,

I`ve tried everything and I cannot seem to get working.

I'm using both lastest version of Captcha and Webform 3.

The weight doesn't seem to work for me.

If anyone would be able to help I would greatly appreciated it.

Thanks,
webadpro

vegantriathlete’s picture

Title: Submit button over captcha, can't figure out how to move below » Don't like where captcha is placing itself on the form
FileSize
181.12 KB

Here is a link to the site:

http://pathwaysdenver.com/contact
I've attached a screen print just for good measure.

I have used hook_contact_mail_page_alter to add the phone number to the contact form. I do sort and reweight the items in the function. Is this what is causing the problem? I haven't found anywhere that I can set the weight for the captcha placement and I don't really want to hack the code.

I want the captcha to appear at the bottom, just above the submit button.

It works fine on this site:

http://personalbestlifecoaching.com/contact

This site is using the standard contact form.

vegantriathlete’s picture

Per #4, I deleted the entry from the variables table. At first when I went back to the contact page, the fieldset was still in the same position as before. When I checked the variables table, the entry was still missing. So, I went back into User Management >> CAPTCHA and went into the reCAPTCHA tab and just clicked save settings. Now when I went back into the contact form (as an anonymous user) the fieldset is appearing exactly where I want it to! I'm not sure why it placed it differently than the first guess.

Anyway, my issue seems to be resolved.

@webadpro maybe if you try the steps I did it will resolve it for you, too?

1) delete captcha_placement_map_cache from the variable table
2) go back into CAPTCHA configurations and click save configuration
3) logout
4) visit page as an anonymous user

webadpro’s picture

@vegantriathlete thanks. I dont know why, but this sure did the magic.

thank you very much for these little 4 steps.

luthien’s picture

for webform 3, adding the fix from the post below solved the problem of the captcha image placed below the submit button.

http://drupal.org/node/790620

can the fix be included as part of the next captcha release?

marty’s picture

I'm working on this issue easing into a role as a Captcha module co-maintainer. Have a D6 site set up for this problem but am unfamiliar wiith mailchimp's setup. Can you provide some details on how I might replicate this problem, either with Mailchimp or some other way?

igorik’s picture

Hi

this doesn't work for me on user/register where I have content profile (it's fieldset are shown using vertical tabs)

I removed from my variables table this row, then I save settings on image captcha, then I clear cache, but no change :(
I have captcha on top of user register form...

there could be some selectbox on this settings with values -10 to 10 for weight of captcha form... or to add captcha always on bottom form.

Thanks
Igor

quicksketch’s picture

Category: support » bug
Status: Active » Needs review

I can't reproduce this as a problem, but users are still complaining of the positioning in the Webform queue (#883550: CAPTCHA below the submitting button). Here's the suggested change in patch form from this other Webform issue #790620: Captcha placed below submit button.

quicksketch’s picture

FileSize
675 bytes

Ah the patch for previous comment.

Status: Needs review » Needs work

The last submitted patch, captcha_weight.patch, failed testing.

soxofaan’s picture

FYI: the CAPTCHA placement is cached, and this cache can become invalid when forms (e.g. webform) change in structure, which can cause undesired placement of the CAPTCHA element.
Issue #766190: Flush CAPTCHA placement cache adds a button to flush the CAPTCHA placement cache and it fixes the problem in some cases.

soxofaan’s picture

Status: Needs work » Needs review

testbot?

brulain’s picture

FileSize
542 bytes

Hi,

Until Webform 3.0, I encounter this same issue in some Webform forms of my sites. I have simply fixed it with jQuery.

1 - In your theme directory, add this entry into the .info file (don't forget to clear caches after):

scripts[] = captcha.js

2 - In your theme directory, add the captcha.js file with this code inside it:

Drupal.behaviors.captcha = function() {
  var webformCaptcha = $('.webform-client-form .captcha');
  if (webformCaptcha.length > 0) {
    webformCaptcha.each(function(i) {
      var webformButton = $('#edit-actions');
      $('#edit-actions').remove();
      webformButton.insertAfter(webformCaptcha[i]);
    });
  };
};

I attach the captcha.js file. Regards.

NB1: This works fine, even with Webform Block module,... except if JS is disabled in the browser!
NB2: .detach() method can't be used, because Drupal 6.19 jQuery version is only 1.2.6
NB3: Prefer to put captcha.js file into a subdirectory (ex. 'your_theme/js') and modify the script declaration in the .info file (ex. 'scripts[] = js/captcha.js')

brulain’s picture

FileSize
609 bytes

Arrrgh... Sometimes, the .captcha class is wrapped in the div#edit-actions tag, sometimes not. In the first case, captcha seems to be correctly displayed (above buttons), but captcha.js code removes both !

Here is a new version of captcha.js which takes care of it:

Drupal.behaviors.captcha = function() {
  var webformCaptcha = $('.webform-client-form .captcha');
  if (webformCaptcha.length > 0) {
    webformCaptcha.each(function(i) {
      var webformButton = $('#edit-actions');
      if (webformButton.children('.captcha').length == 0) {
        $('#edit-actions').remove();
        webformButton.insertAfter(webformCaptcha[i]);
      }
    });
  };
};
soxofaan’s picture

Issue tags: -submit, -captcha, -position, -button, -move, -before

#24: captcha_weight.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +submit, +captcha, +position, +button, +move, +before

The last submitted patch, captcha_weight.patch, failed testing.

soxofaan’s picture

Version: 6.x-2.1 » 6.x-2.x-dev
Status: Needs work » Needs review
FileSize
726 bytes

reroll of patch #24,
hopefully test bot accepts this one

drupadawan’s picture

Issue tags: -submit, -captcha, -position, -button, -move, -before

#32: 765758_placment_24.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +submit, +captcha, +position, +button, +move, +before

The last submitted patch, 765758_placment_24.patch, failed testing.

clashar’s picture

any update for D7?

naveenvalecha’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Issue summary: View changes
Issue tags: -
Cyberwolf’s picture

We are using this code in D8, where the same issue occurs on our webform:

(function (Drupal, $) {
Drupal.behaviors.captcha = {
  attach: function () {
    var webformCaptcha = $('.webform-submission-form .captcha');
    if (webformCaptcha.length > 0) {
      webformCaptcha.each(function (i) {
        var webformButton = $(webformCaptcha[i]).prevAll('#edit-actions').first();
        if (webformButton) {
          webformButton.remove();
          webformButton.insertAfter(webformCaptcha[i]);
        }
      });
    }
  }
}

})(Drupal, jQuery);
wundo’s picture

Status: Needs work » Closed (works as designed)