Question

I'm having trouble with events in a MooTools Form.Request():

new Form.Request(e.getParent('form'), $('update'), {
    resetForm: false,
    onRequest: function () {
        loading(e)
    },
    onSuccess: function () {
        toggle(e)
    }
}).send();

The onSuccess event triggers happy, but the onRequest event does nothing. Am I overlooking something?

Was it helpful?

Solution

The name of the event is send not request. So you are looking for onSend:.

Have a closer look at the documentation:

Events:

  • send - (function) The function to execute when the request is sent. Passed the form being submitted and the data (an object) being submitted.
  • failure - (function) The function to execute when the request fails. Passed the XHR that is returned by Request on failure.
  • success - (function) The function to execute when the request succeeds. Passed the target being updated, the request text, and the request xml.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top