but I have a question on your solution when you call this.formObj.reset(); directly, you are executing the form reset function, but you are not executing the objects method, right? my real reset function is like this
reset:function(e){ if (this.withValidation()){ this.validObj.reset(); } this.obj.reset(); unsetResponseMsg(); if (this.actionID=='add'){ this.setAddFrmDefaultValue(); if (this.withMultiFCK()){ this.multiFCK.setContent(''); } } else { this.setActionID('reset'); this.getPageInitValue(); } }, so I think your solution won't really work in my case and if I pass the FormExt object into AjaxRequest, it should be work, but A object's method create B object, and then pass A object into B object I feel strange on it, so I don't know how to do to make it works. On 3月6日, 上午1時18分, "Richard Quadling" <[EMAIL PROTECTED]> wrote: > On 05/03/2008, vtsuper <[EMAIL PROTECTED]> wrote: > > > > > > > > > There are 2 classes FormExt, AjaxRequest > > I create a FormExt object and when the user submit the form, then I > > will call another AjaxRequest Object > > When the AjaxRequest finish the process, then it will trigger > > onComplete > > > I would like the onComplete method will call the FormExt.reset() > > so hwo to do this? > > I must pass the FormExt obj to the AjaxRequest??? and other method??? > > > var FormExt = Class.create({ > > initialize: function(id){ > > this.id=id; > > this.obj=$(this.id); > > this.ajaxObj=''; > > > this.eventSubmit=this.submit.bindAsEventListener(this); > > Event.observe(this.id, 'submit', this.eventSubmit); > > }, > > > submit:function(e){ > > this.ajaxObj=new AjaxForm(this.id); > > this.ajaxObj.startAjax(); > > break; > > }, > > > reset:function(){ > > this.obj.reset(); > > } > > }); > > > var AjaxRequest = Class.create({ > > initialize: function(id){ > > this.frmObj=$(id); > > this.ajaxObj=''; > > }, > > > startAjax: function(){ > > this.ajaxObj = new Ajax.Request( > > 'abc.php',{ > > onComplete:this.onComplete.bind(this) > > } > > ); > > } > > > onComplete:function(){ > > alert('complete now'); > > } > > }); > > var AjaxRequest = Class.create > ({ > initialize: function(id) > { > this.frmObj=$(id); > this.ajaxObj=''; > }, > > startAjax: function() > { > this.ajaxObj = new Ajax.Request > ( > 'abc.php', > { > onComplete:function() > { > alert('complete now'); > this.formObj.reset(); > } > } > } > }); > > maybe. > > Sorry for the reform. Makes it easier for me to read. > > Basically added > > this.formObj.reset(); > > to the onComplete function. > -- > ----- > Richard Quadling > Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!"- 隱藏被引用文字 - > > - 顯示被引用文字 - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---