In mollom_form_alter, mollom attempts to increase buttons' weights of the forms which the mollom form is attached to.
The code ignores webform submit form elements. (I do use webform's latest release: 6.x-3.0-beta5.)

If in function mollom_form_alter I replace

if (isset($form[$key]['#type']) && in_array($form[$key]['#type'], array('submit', 'button', 'image_button'))) {

by

if (isset($form[$key]['#type']) && in_array($form[$key]['#type'], array('submit', 'button', 'image_button')) ||
            isset($form[$key]['submit']['#type']) && $form[$key]['submit']['#type'] == 'submit') {

the webform submit form elements are taken into account.
I'm not sure this is generic enough.
I do know this also does not seem to work with custom forms that have an extra parent key in the form array structure.
F.e. weight of element $form['mycustomform']['submit'] is not modified. Weight of $form['submit'] is.

Comments

sun’s picture

I wonder whether Webform shouldn't rather assign a (better) #weight value for its buttons instead?

dries’s picture

I'd "yes" but I've pinged quicksketch and pointed him to this issue.

quicksketch’s picture

Setting a weight for the buttons would be a good idea. Hopefully that would more correctly fix #790620: Captcha placed below submit button also.

sun’s picture

Version: 6.x-1.3 » 7.x-1.x-dev
Category: feature » task
Status: Active » Needs review
StatusFileSize
new971 bytes

I've re-opened #790620: Captcha placed below submit button and provided a first patch against Webform HEAD.

For Mollom HEAD, we can simplify the code a bit.

Let's tackle D6 afterwards.

sun’s picture

StatusFileSize
new2.52 KB

Attached patch should fix the issue for D6. I'm already using a similar code in http://drupal.org/project/button_style for D6, which actually was the prototype for D7's #type 'actions'.

dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

dries’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Needs review

Oops, still need to review #5.

sun’s picture

StatusFileSize
new2.64 KB

Slightly improved the comments.

sun’s picture

On a third look, the code in HEAD can be totally compressed into a single line now. :)

For D6, I was not entirely happy with the detection of 'actions' yet. We should expect the parent key, but no actions][#type. If it has a #type, then it's not a button container, as you'd use #prefix and #suffix under D6.

dries’s picture

Committed the patch for CVS HEAD. Still looking at the patch for D6.

sun’s picture

sun’s picture

sun’s picture

Status: Needs review » Reviewed & tested by the community
dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to DRUPAL-6--1. Thanks.

Status: Fixed » Closed (fixed)

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

  • Commit f737b47 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #830228 by sun: weights of submit buttons of webforms are not...
  • Commit ff9e5e5 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #830228 by sun: weights of submit buttons of webforms are not...

  • Commit f737b47 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #830228 by sun: weights of submit buttons of webforms are not...
  • Commit ff9e5e5 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #830228 by sun: weights of submit buttons of webforms are not...