This project is archived and is in readonly mode.

#1148 ✓wontfix
ronin-132801 (at lighthouseapp)

onSuccess event is fired more than once

Reported by ronin-132801 (at lighthouseapp) | January 16th, 2011 @ 04:42 PM

mootools 1.3: When sending a form the onSuccess event will be fire once. When sending the form the next time, the onSuccess will be fired twice ...and so on... in mootools 1.2 the event is only fired once.

$('formelement').addEvent('submit', function(e) {
  e.stop();
  this.set('send', {
    onComplete: function() {
      console.log('complete');
    },
    onSuccess: function(response){
      console.log('SUCCESS');
    },
    onFailure: function(error) {
      console.log('failed');
    }
  });
  this.send();
});

Comments and changes to this ticket

  • Arian

    Arian January 16th, 2011 @ 04:49 PM

    • State changed from “new” to “wontfix”

    This is because in 1.3 every time you set a new event, it only gets added instead of replaced. So every time you submit your form an event is added.

    You should first set the options for the request, and only call the .send method in your submit event: http://jsfiddle.net/Xqyh4/1/

  • ronin-132801 (at lighthouseapp)

    ronin-132801 (at lighthouseapp) January 16th, 2011 @ 05:19 PM

    okay, that's fine and the new code works. But all the existing code has now to be redesigned :-( when using the version with "compatiblity", this happens also.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Pages