I apologize, I realized that I needed to actually create an instance
of methodCall, and then call that. I was trying to call:
        methodCall.call('afunction','someargs');

I looked again at the example code in the API docs, and created an
instance like this:
        var functionCall = new methodCall('functionCall');

And then called that instance like this:
        onclick="functionCall.call('afunction',someargs');"

So, hopefully if any other newbies have the same problem they will be
able to search the group and find this mostly one-sided discussion :)

On May 13, 9:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I tried kangax's suggestion, but it didn't change anything.
>
> On May 13, 9:17 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > This bit of code gives me the same error:
> > 'Error: this.initialize has no properties
> > Source File:http://bpickens.in-forum.com/template/js/prototype.js
> > Line: 48'
>
> >                 var methodCall = Class.create({
> >                         initialize: function(method,args,loadmessage) {
> >                                 this.method = method;
> >                                 this.args = args;
> >                                 this.loadmessage = loadmessage;
> >                         },
> >                         call: function() {
> >                                 alert(method);
> >                         }
> >                 });
>
> > Im using the newest version downloaded from the site, prototype
> > 1.6.0.2. Do my variable assignments in the initialize() function need
> > to be bound? And Firebug isn't being very helpful either...
>
> > On May 12, 7:16 pm, kangax <[EMAIL PROTECTED]> wrote:
>
> > > I'm not getting any errors when running this snippet. Which version of
> > > prototype are you using?
> > > It might also be a good idea to bind "this.result" to an instance of
> > > your "methodCall" class:
>
> > > DWREngine._execute(_ajaxConfig._cfscriptLocation, null, this.method,
> > > args, this.result.bind(this));
>
> > > - kangax
>
> > > On May 12, 5:53 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Hi, Im new to prototype and am trying to get a grasp on using it.
>
> > > > I created a class with a few methods, but am getting the error
> > > > 'this.initialize has no properties' I did a search on the site but
> > > > didn't uncover anything helpful.
>
> > > > Here is my code:
>
> > > >                 var methodCall = Class.create({
> > > >                         initialize: function(method,args,loadmessage) {
> > > >                                 this.method = method;
> > > >                                 this.args = args;
> > > >                                 this.loadmessage = loadmessage;
> > > >                         },
> > > >                         call: function(){
> > > >                                 
> > > > DWREngine._execute(_ajaxConfig._cfscriptLocation, null,
> > > > this.method, args, this.result);
> > > >                         },
> > > >                         loadMessage: function() {
> > > >                                 if (this.loadmessage != '') {
> > > >                                         
> > > > DWRUtil.useLoadingMessage(this.loadmessage);
> > > >                                 }
> > > >                         },
> > > >                         result: function(ret) {
> > > >                                 $('FCWiz').innerHTML = ret.dump();
> > > >                         }
> > > >                 });
>
> > > > Also, while i am posting, Im using DWR to perform ajax requests
> > > > directly on my serverside functions. If you look at the the
> > > > methodCall.call() function, you can see the code for doing this. the
> > > > last argument is specifies is the function for handling the response.
> > > > I would like to make it the methodCall.result() function. I specified
> > > > it as this.result, is this correct?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to