Hi,

In this code:

function click() {
        var opt = {
                        method: 'get',
                        onCreate: 'create',
                        onLoading: 'loading',
                        onSuccess: 'sucess',
                    onException: 'error'
                };
        var login = new jsTTALogin(URL, opt);
}

...you're providing strings instead of functions. That's causing an
exception, which Prototype then tries to handle via `onException` --
but `onException` is *also* a string, not a function. The error
message in Firefox+Firebug is wrong (interestingly). It's triggered
from line 1540 in Prototype.js:

1539 dispatchException: function(exception) {
1540   (this.options.onException || Prototype.emptyFunction)(this,
exception);
1541   Ajax.Responders.dispatch('onException', this, exception);
1542 }

...which resolves to:

    "error"(this, exception)

...and of course, "error" is a string, not a function.

So that's what's going wrong. It looks to me like you're trying to
pass the names of functions that exist in your subclass as options.
That's not how you reference functions, you need to provide a function
reference.

Off-topic: I'm a bit surprised that `initTTA` in jsTTA.js works (but
it does seem to), it seems to me that it's trying to call `eval` on a
script element, which I would expect to have...undefined results. You
can (and probably should) drop that `eval` and it should work just
fine, more here:
http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynamically

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Mar 24, 10:45 am, Omar Adobati <omar.adob...@gmail.com> wrote:
> 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, Mar 24, 2010 at 10:26, T.J. Crowder <t...@crowdersoftware.com> wrote:
> > 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: '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 & script.aculo.us" group.
> > To post to this group, send email to
> > prototype-scriptacul...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculou 
> > s%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to