javascript - Changing YUI (or AlloyUI) method behaviour -


i trying change _onformreset method in yui (or alloy ui) - think common javascript (oop) thing, noob in js oop , yui (been using jquery till now) - how can change functionality of method (keeping other methods are)?

for example;

currently method looks like:

_onformreset: function(event) {     var instance = this;     instance.resetallfields(); }, 

(src: http://alloyui.com/api/files/alloy-ui_src_aui-form-validator_js_aui-form-validator.js.html#l1192)

but want like:

_onformreset: function(event) {     var instance = this;     instance.resetallfields();     /* pseudo: **a.) action logged (ajax call db) b.) fields in form reset (default behaviour) + form get's new anti csfr uid via ajax c.) notification shown (like message in example let's say: form reseted!) d.) (submit button reappears)** ...  */ }, 

i tried like:

/* trying hijack thingz */  var formreset = y.component.create({ // component name name : 'form-validator-reset',  extends : y.base,  // base component's method extends prototype : {     _onformreset: function(event) {             var instance = this;             instance.resetallfields();             y.one("#submitit").sethtml("<h4>thanks, form submitted ok</h4>");         }     } }); 

but no success.

i looked @ documentation , wasn't able find way, seems missing oop javascript basics :(

can me "catch fish" :)

trying learn (oop) javascript long time, reading lot online, best way me learning coding , stuck...

so wish have can use in forms when reset button clicked (in same way change submit) - oop method - attached default reset function, upgrading in "my" way.

it looks you're trying tackle wrong way. unless you're doing exercise in overriding method shouldn't if you're trying print out thank you.

also if you're looking thank user submitting should trying when user submits form, not when form reset. you'd subscribe function 'submit' event of form.

a.one("#my_form").on("submit", function() {     y.one("#submitit").sethtml("<h4>thanks, form submitted ok</h4>"); }); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -