[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-24 Thread T.J. Crowder
Hi, Again, why not just create a minimum failing test case? Start here[1], add your subclass, and if it breaks post the code. [1] http://proto-scripty.wikidot.com/self-contained-test-page -- T.J. On Mar 23, 4:39 pm, 0m4r omar.adob...@gmail.com wrote: fixing a typo: == var options = {user:

Re: [Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-24 Thread Omar Adobati
Hi T.J. I've set up a small minimum failing test here: http://www.adobati.it/test/ http://www.adobati.it/test/I have the same error as described above: == Prototype.emptyFunction is not a function (this.options.onException || Prototype.emptyFunction)(this, exception); == Thanks, Omar On Wed,

[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-24 Thread T.J. Crowder
Hi, In this code: function click() { var opt = { method: 'get', onCreate: 'create', onLoading: 'loading', onSuccess: 'sucess', onException: 'error' };

[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-24 Thread 0m4r
Wow, thanks T.J.!! your answer makes a lot of sense.. but, now, how I am supposed to pass a function name instead of a string? I'm sorry if the question sounds stupid to you but I don't know how to achieve this target. Thanks Omar On Mar 24, 12:55 pm, T.J. Crowder t...@crowdersoftware.com

[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-24 Thread T.J. Crowder
Hi Omar, In the general case, you can reference a function simply by using its name whenever it's in scope, which is to say, if you could call it. So: function foo() { alert(Hi from foo!); } function bar(func) { func(); } foo(); bar(foo); ...results in

Re: [Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-24 Thread Omar Adobati
Thanks a lot T.J. I will read your answer carefully later on, but it looks very complete and clear I really appreciate your help. --- Omar Adobati On Wed, Mar 24, 2010 at 15:08, T.J. Crowder t...@crowdersoftware.com wrote: Hi Omar, In the general case, you can reference a function

[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-23 Thread Omar Adobati
just to be clear, I got errors on this line of code of prototype.js: == 1539 dispatchException: function(exception) { 1540 (this.options.onException || Prototype.emptyFunction)(this, exception); 1541 Ajax.Responders.dispatch('onException', this, exception); 1542 } == and following the error

[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-23 Thread T.J. Crowder
Hi, and following the error message: == Prototype.emptyFunction is not a function == That's very, very strange. It sounds like this relates to something *else* on the same page. If you create a minimum test case, I think you'll find it works -- then you can start adding things back in until

[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-23 Thread 0m4r
I did some further tests and it now looks like it only works when the single onSuccess callback function is specified, if I try to pass within the option variable other callbacks (like onLoading, on Create, etc) nothing happens and the onSuccess callback is not called at all. This is very strange.

[Proto-Scripty] Re: Extending the Ajax.Request object

2010-03-23 Thread 0m4r
fixing a typo: == var options = {user: 'myuser', pwd:'mypwd', type:'myType', onSuccess:'success', onException:'error'}; var url = 'http://www.url.com'; var myAjax = new myAjaxR(url, options) == -- You received this message because you are subscribed to the Google Groups Prototype