Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#11 | captcha-placement-fix-for-multiple-button-forms.patch | 525 bytes | yenerunver |
|
Comments
Comment #1
CarbonPig CreditAttribution: CarbonPig commentedSame Question.
Comment #2
Moonshine CreditAttribution: Moonshine commentedMost 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().
Comment #3
CarbonPig CreditAttribution: CarbonPig commentedHow 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
Comment #4
Moonshine CreditAttribution: Moonshine commentedHowdy...
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:
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.
Comment #5
PRZ CreditAttribution: PRZ commentedI 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.
Comment #6
Jordan.Schmitt CreditAttribution: Jordan.Schmitt commentedPaul
Thanks for the tip. I did the same thing and it worked perfectly.
Comment #7
scott859 CreditAttribution: scott859 commentedPaul
Thanks also - I was having the same issue and this solved it.
Scott
Comment #8
soxofaan CreditAttribution: soxofaan commentedissue #367046: Weight settings UI for CAPTCHAs should tackle this problem (patch is in the making), so I set this as a duplicate
Comment #9
Quinti CreditAttribution: Quinti commentedThanks 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
Comment #10
robertdjung CreditAttribution: robertdjung commentedanother way to do this is using the DEVEL module, if you turn on theme developer, it shows the actual weight numbers. for me, anyway!
Comment #11
yenerunver CreditAttribution: yenerunver as a volunteer commentedIn 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.
Comment #12
tonylegrone CreditAttribution: tonylegrone commented#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!
Comment #13
MatthijsG CreditAttribution: MatthijsG as a volunteer commented#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.
Comment #14
RKopacz CreditAttribution: RKopacz commentedAny developments regarding the patch? Committed in dev?
Comment #15
vikramy CreditAttribution: vikramy as a volunteer commented#11 worked for me.
Comment #16
elachlan CreditAttribution: elachlan commentedComment #19
elachlan CreditAttribution: elachlan commented