I'm trying to use Mootools Ajax.Form, and was able to make a successful test installation with this: http://demos111.mootools.net/Ajax.Form
ONLY if I downgraded my mootools script to 1.11. For the rest of the stuff on my site, I've been using 1.2.4.
I'm guessing there's a conflict issue going on...but wasn't sure how to fix this? I did some searching for the Ajax.Form to see if anyone else had this problem, but so far have been unsuccessful.
Any help would be much appreciated. Thank you!
The difference is that the Element.send
shortcut changed it's signature between 1.11 and 1.2.x
The new signature no longer accepts the request options as part of the .send method, only a URL is accepted (to allow overriding the URL to GET/POST to on each request).
With the new API, you have to use the set
method on the form element to set the send
options like this:
document.id('myForm').set({
send: {
onRequest: function() { /* do something here */ },
onComplete: function() { /* do something else */ }
}
});
you can see a full example on how to use the Element.send method on the following fiddle: http://jsfiddle.net/S3H4G/2/
You can refer to the official docs to see the current Element.send signature, and the Request object docs to see all the available options you can pass in the set
method. Do notice that in case of forms, the url
, method
and data
parameters default to what the form element currently has set in the HTML.