I am seeing an issue where the captcha is placed below the form submit button using Captcha 6.x-2.1 with Webform 6.x-3.0-beta5.
This problem was also noted in a different issue here: http://drupal.org/node/735202#comment-2786900
Thanks for any help you can provide.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | webform-HEAD.form-actions.12.patch | 692 bytes | sun |
| #8 | webform-HEAD.form-actions.8.patch | 692 bytes | sun |
Comments
Comment #1
debbo1977 commentedHi, did you add the captcha in through the webform or whist viewing the form?
i.e did you go to form components when creating the form and choose captcha there,
or did you view the form live and choose the "insert captcha..." drop down from there?
Comment #2
jwinton commentedThe captcha was added through the Captcha module general settings by entering the form ID and selecting the challenge type.
This method worked great with Webform 2.0 -- should I be going another route with Webform 3?
Thanks!
Comment #3
louiswolf commentedThe placement of the captcha element is determined by its 'weight'.
In captcha.inc the weight of the captcha element is determined by the weight of the preview button (20) and is set 0.1 lower (19.9). However, the weight of the submit button (19) is not taken into account so the CAPTCHA block ends up between these buttons (19 < 19.9 < 20).
captcha.inc can be adjusted so set the weight 1.1 lower (instead of 0.1), thus placing the CAPTCHA element before the submit button.
line 315:
$captcha_element['#weight'] = $target_weight - 1.1;
Comment #4
jwinton commentedThanks for the response. I tried making that change to captcha.inc and, unfortunately, it did not seem to make a difference. I also tried clearing cache, removing and then re-adding the captcha to the form, but no luck. Did this work for you?
Comment #5
luthien commentedIt worked well for me, add the fix here:
Comment #6
jwinton commentedThanks! That worked for me.
Changing the line at 315 did not work for me, but the changes to line 306 that you posted did the trick.
Comment #7
jmbarlow commentedPerfect - that solves it for me.
Comment #8
sunRe-opening due to #830228: Weights of submit buttons of webforms are not modified
To begin with HEAD/D7, all buttons in all forms are supposed to be contained in a #type 'actions' element.
Comment #9
quicksketchDo #type = 'actions' already have a default weight? What makes them show up at the bottom of a form?
Comment #10
sun♥ http://api.drupal.org/api/function/system_element_info/7 ♥
yes :)
Comment #11
quicksketchWeight 100 might not be enough on a really big form, I've seen forms with hundreds of components and it'd make me a little easier if we just kicked it down to 1000 like it is now.
Comment #12
sunIf that's the case, then we can surely set a custom, higher weight.
Comment #13
quicksketchSuper, while this looks like a no-brainier fix for D7, what's the solution for D6?
Comment #14
sunFor D6, I suggest to go with a Mollom-only fix, since you prepared Webform on D7 standards already - as propatched in #830228-5: Weights of submit buttons of webforms are not modified
Comment #15
quicksketchThanks, #12 committed to the D7 branch..