Hi craig, I've tested the following code, and it works in FF3 !!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/..."> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="prototype.js" type="text/javascript"></script> <script src="scriptaculous.js" type="text/javascript"> </script> </head> <body> <div id="myId"> <input id="bt1" type="submit"></input> <input id="bt2" type="submit"></input> </div> <script type="text/javascript"> var Slider = Class.create({ initialize: function (elContainer) { this.elContainer = elContainer; if($(this.elContainer).getStyle('left') == '0px') { this.minimize(this.doit); } else { this.doit(); } }, minimize: function(fun) { new Effect.Morph(this.elContainer, { style: 'left: 940px;', duration: 0.3, afterFinish: function() { $(this.elContainer).setStyle({ left: '-940px' }); if(fun != null) { fun(); //<--- !!!!!!!!! yes, this works!, NO errors !!!!!!!!!! } }.bind(this) }); }, maximize: function() { $(this.elContainer).show(); new Effect.Morph(this.elContainer, { style: 'left: 0px;', duration: 0.5 }); }, doit: function () { } }); // BUT IN SUBCLASSES errors: var SliderCategory = Class.create(Slider, { initialize: function($super, elContainer) { $super(elContainer); }, doit: function() { new Ajax.Updater(this.elContainer,'category_add.php',{ onCreate: function () { }.bind(this), onComplete: function(request,result) { }.bind(this) }); } }); Ajax.Updater = Class.create(Ajax.Request, { initialize: function($super, container, url, options) { this.container = { // <----- ERROR Cannot convert undefined or null to Object success: (container.success || container), failure: (container.failure || (container.success ? null : container)) }; alert($H(this.container).inspect()); options = Object.clone(options); var onComplete = options.onComplete; options.onComplete = (function(response, json) { this.updateContent(response.responseText); if (Object.isFunction(onComplete)) onComplete(response, json); }).bind(this); $super(url, options); } }); new SliderCategory('myId'); </script> </body> </html> I did not modify anything, and the "alert($H(this.container).inspect ());" return: #<Hash:{'success': 'myId', 'failure': 'myId'}> without no error -- david On 17 fév, 13:12, marioosh <[email protected]> wrote: > On 17 Lut, 12:14, "T.J. Crowder" <[email protected]> wrote: > > > Hi, > > > What's the error? > > -- > > Error: Cannot convert undefined or null to Object > Slider class is a base class and doit() method is redefined in > subclasses. I see that calling fun() works, but i get error in > redefined method doit(). > > Redefinition here: > > var SliderCategory = Class.create(Slider, { > > initialize: function($super, elContainer) { > $super(elContainer); > }, > > doit: function() { > new Ajax.Updater(this.elContainer,'category_add.php',{ > > onCreate: function () { > }.bind(this), > > onComplete: function(request,result) { > }.bind(this) > > }); > }, > ... > > } > > Error is in prototype.js: > ....(cut)... > > Ajax.Updater = Class.create(Ajax.Request, { > initialize: function($super, container, url, options) { > this.container = { // <----- ERROR Cannot > convert undefined or null to Object > success: (container.success || container), > failure: (container.failure || (container.success ? null : > container)) > }; > > options = Object.clone(options); > var onComplete = options.onComplete; > options.onComplete = (function(response, json) { > this.updateContent(response.responseText); > if (Object.isFunction(onComplete)) onComplete(response, json); > }).bind(this); > > $super(url, options); > }, > > ....(cut)... > > I've pasted in pastie.org too for better view --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
