I'm trying to attach a new behavior to a submit button that already has AHAH behavior attached to it. This is what I have. If I bind a 'mouseover' event, it works, so I know the selector is correct.

Is it possible that since the AHAH will return FALSE, that any further click events will be ignored? Is there a way to attach further behavior to a button other than the default AHAH behavior defined by Drupal?

Drupal.behaviors.mediaAhahHideBrowser = function (context) {
  $('.media-browser-submit:not(.mediaAhahHideBrowser-processed)', context).addClass('mediaAhahHideBrowser-processed').bind('click', function () {
    // Hide the button.
    $(this).hide();
    // Next replace the browser with a progress indicator.
    // @TODO
  });
};

Comments

aaron’s picture

Status: Active » Needs work
aaron’s picture

Status: Needs work » Fixed

turns out that the docs at http://api.drupal.org/api/file/developer/topics/forms_api_reference.html... lie: the default ahah event for submit buttons is 'mousedown', not 'click'...

fixed now in anycase -- i set the ahah event to click (which makes more sense than mousedown, which falsely registers if you click and move your mouse away, and doesn't register a space bar event when the element has the focus).

Status: Fixed » Closed (fixed)

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

girishmuraly’s picture

Thanks a ton aaron, you saved me a lot of time wondering what was going on!

gaëlg’s picture

Wow, thanks ! Actually I add to change to "mousedown", because click did not work. Not easy to figure out !

vishun’s picture

<3