Woops, my detach looks like this actually:

        detach: function(){
                this.form.removeEvent('submit',this.submit_handler);
                return this;
        },

On Sep 7, 12:23 pm, Ryan Florence <[email protected]> wrote:
> Here's a small class, my detach method doesn't work.  I haven't done  
> much with removeEvent, not sure what the problem is here.  When I call  
> detach on the object, it doesn't detach the submit handler.
>
> Request.JSON.Form = new Class({
>
>         Extends: Request.JSON,
>
>         initialize: function(form,options){
>                 this.parent(options);
>                 this.form = $(form);
>                 this.options.url = this.form.get('action');
>                 this.attach();
>         },
>
>         attach: function(){
>                 this.form.addEvent('submit',this.submit_handler.bind(this));
>                 return this;
>         },
>
>         detach: function(){
>                 this.form.removeEvent(this.submit_handler);
>                 return this;
>         },
>
>         submit_handler: function(event){
>           event.stop();
>           this.post(this.form);
>         }
>
>
>
> });

Reply via email to