I have a node type with 8 CCK types, and I have rearranged the order of elements on the page. There doesn't seem to be a way for placing Captcha where I want it, and the default position is between the third and fourth CCK field, above the title and body, and way above the submit button. http://www.sandycove.org/community/test/share-your-story

Is there a way to place the captcha form where I want it, or at very least move it to the last item before the submit button?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

CarbonPig’s picture

Same Question.

Moonshine’s picture

Most likely you have some some form elements that weight "less" and some that way "more" so captcha is rendered between them. You can either reorder the weights of your cck fields so they are all lighter then the captcha, or change the weight of the captcha element with hook_form_alter().

CarbonPig’s picture

How exactly would I "change the weight of the captcha element with hook_form_alter()"

I'm still a novice at all of this, so if you, or someone else has time, I would appreciate a detailed description of what exactly to I should do. There has been a lot of people on the forums wondering about this, so any time you have would be appreciated.

Thanks,

The Carbon Pig

Moonshine’s picture

Howdy...

What I was suggesting would involve placing some php code in a custom module that you would create for making changes to your site. Not sure if that's something you're comfortable with or not.

I took a quick look at the Captcha code and it does look like there are some key differences re: placement with the Drupal 5 version vs. the Drupal 6 version. What version of Drupal are you using?

For example in the Drupal 6 version there is a pre_render function in place for the sole purpose of placing the Captcha right before the first form button it finds:

    // set the weight of the CAPTCHA element a tiny bit smaller than the lightest button weight
    // (note that the default resolution of #weight values is 1/1000 (see drupal/includes/form.inc))

So perhaps you have another field in the form offering up a button that's making captcha want to place it there. Really if that's the case, the Captcha should probably offer some other weighting options as fields like imagefield have their own buttons as do multivalue cck fields in general.

Either way, it can be adjusted via some code, but that does depend on what version of Drupal you're using.

Edit: Actually in looking at the D6 code more, it should get placed right before the actual submit "button"s, so I don't think field buttons should affect it.

PRZ’s picture

I had this same problem with Drupal 6.6 and corrected by changing the field weights in my CCK form. At first I couldn't do this as I only had the Javascript Drag Cross Bars. After turning off Javascript in my browser (Safari) I could manually change the weight of each field.

I found I had to have all fields with a weight of less than 0 (i.e., -9 through -1) for the CAPTCHA to be placed as the last element on my CCK form when displayed for the user. Any weights of 0 or more were placed after the CAPTCHA element on the form.

Paul.

Jordan.Schmitt’s picture

Paul

Thanks for the tip. I did the same thing and it worked perfectly.

scott859’s picture

Paul

Thanks also - I was having the same issue and this solved it.

Scott

soxofaan’s picture

Component: Image Captcha (image_captcha) » User interface
Category: bug » feature
Status: Active » Closed (duplicate)

issue #367046: Weight settings UI for CAPTCHAs should tackle this problem (patch is in the making), so I set this as a duplicate

Quinti’s picture

Thanks guys

and, in d 6x, disabling de js, we can put the exact order,

the captcha have a weight of 1, then, putting all the fields in negative is done,

thanks

robertdjung’s picture

another way to do this is using the DEVEL module, if you turn on theme developer, it shows the actual weight numbers. for me, anyway!

yenerunver’s picture

Version: 6.x-1.0-rc2 » 7.x-1.3
Issue summary: View changes
Status: Closed (duplicate) » Patch (to be ported)
FileSize
525 bytes

In D7, if you use Field Collection or Entity Forms etc., you might end up with more than 1 Form Submit Button.

Since Captcha places itself according to the position of Form Actions Area or Form Submit Button, this situation creates a conflict and Captcha places itself above of the first button (this button can be positioned in the middle of the form).

This patch looks for Form Button count and places Captcha above the last button, which is generally the Submit button.

tonylegrone’s picture

#11 worked great for me. Just don't forget to go to admin/config/people/captcha and clear the placement cache. That threw me off for a minute.

Thanks!

MatthijsG’s picture

#11 didn't work for me, even after clearing cache & clearing captcha placement on admin/config/people/captcha. Use some fieldsets and vertical tabs on the add-page.

RKopacz’s picture

Any developments regarding the patch? Committed in dev?

vikramy’s picture

#11 worked for me.

elachlan’s picture

Status: Patch (to be ported) » Needs review

  • elachlan committed c5af643 on 7.x-1.x authored by yenerunver
    Issue #315827 by yenerunver: Placement of Captcha - why in middle of...

  • elachlan committed 06adf36 on 8.x-1.x authored by yenerunver
    Issue #315827 by yenerunver: Placement of Captcha - why in middle of...
elachlan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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