javascript - How extend a function declared inside "options" in mootools? -


i want extend "showerror" function of "form.validator.inline" in mootools. function declared inside "options".

i tried below code, not working.

var exformvalidator = new class({             extends:  form.validator.inline,             options: {                     showerror: function(element) {                         var error = element.getprevious();                         if(error != null){                             error.dispose();                         }                         this.parent(element);                     }                 }         });  

i can make work copying code "mootools-more" below:

        var exformvalidator = new class({             extends:  form.validator.inline,             options: {                     showerror: function(element) {                         var error = element.getprevious();                         if(error != null){                             error.dispose();                         }                         if (element.reveal) element.reveal();                         else element.setstyle('display', 'block');                     }                 }         }); 

but don't think way of doing things. there alternative/correct way ?

have found answer. there "onshowadvice()" event in "form.validator.inline". have extend follows:

        var formvalidator = new form.validator.inline(regform, {                 errorprefix: '',                 serial: false,                 onshowadvice: function(element, advice) {                     var error = advice.getprevious();                     if(error != null) {                         error.dispose();                     }                 }             }); 

the showadvice function calling showerror. calling thing; still question remains. possible extend function in "options" ?


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -