Cheers :) I think it was the '<b><u>set</u>/b>Options' part of the call that threw me. In most places that usually means overwriting what's there. Oh well, you live and learn!
On Jan 14, 5:07 pm, nwhite <[email protected]> wrote: > Yeah I ran into that in the past. > > This documentation helps: > > Events has been designed to work well with the > Options<http://mootools.net/docs/Class/Class.Extras#Options>class. > When the option property begins with 'on' and is followed by a > capital letter it will be added as an event (e.g. 'onComplete' will add as > 'complete' event). > > On Wed, Jan 14, 2009 at 10:52 AM, BB <[email protected]> wrote: > > > OK. I figured out where the flaw in my logic was. > > > I didn't realise that when you set a function/onXXXXX in the Options > > it really adds them as an event to the object, so in effect I was just > > adding additional events for the Request to perform without overriding > > the earlier defined event. > > > I can use the same object now if I remove the events via removeEvents > > ('onComplete') and then set call setOptions with the one event I > > really want to execute. > > > On Jan 12, 11:42 am, BB <[email protected]> wrote: > > > Hi, > > > > I'm currently making Requests to a php page to retrieve some > > > information from a database. > > > At the moment, I have 4 Request objects created that all hit the same > > > php page for data and this all works fine. > > > > But, is it possible to override the onComplete/onSuccess options so > > > that I can use just the 1 Request object to replace the 4 I currently > > > have? I'm currently setting the onComplete after the Request object > > > has been created. For example: > > > > var ajax1 = new Request( {url:'/company_reqs.php'} ); > > > > ... > > > ... > > > ... > > > ... > > > ajax1.setOptions( { onComplete:getSomeInfo } ); > > > ajax1.send({ data:{'req':'my_request', 'e':some_value, > > > 'name':some_other_value } }); > > > > and that works fine. But, if I later try to change the onComplete (I'm > > > still hitting the same url for the request): > > > > ajax1.setOptions( { onComplete:getSomeDifferentInfo } ); > > > ajax1.send({ data:{'req':'my_alterrnative_request', 'b':x_value, > > > 'c':y_value } }); > > > > then when ajax1 completes, it calls 'getSomeInfo' (i.e. the original > > > onComplete set on the Request object) and not the new onComplete I > > > tried to set. > > > > I've had a search around here, Google and the mootools docs, but I > > > can't find anything that says you can't do this (or even find posts > > > from others asking the same thing). So, in a nutshell, is it possible > > > to redefine > > > > I'm pretty new to mootools, so feel free to point out if I'm doing > > > something dumb/obviously incorrect. > > > > Thanks v much.
