javascript - ExtJs, custom TextField's getValue() function not being called when form is submitted -


i have custom text field extends ext.form.textfield (extjs 3.1.1). have overridden getvalue submit calculated value instead of raw value in superclass. when calling getvalue directly return value correct. when submitting parent form, getvalue not being called @ (debug messages in getvalue method not appear in console). how can override value returned when form submitted? isn't getvalue correct method override?

here's general layout of class (i can't provide actual code):

myfield = ext.extend(ext.form.textfield, {     constructor: function(config) {         [initialize basic variables....]         myfield.superclass.constructor.call(this, config);     },      initcomponent : function() {          this.on('keypress', this.handler, this);     },      handler : function(field, event, args) {          [set internal value this.myvalue based on superclass value]     },      getvalue : function () {return this.myvalue;} }); 

the above working fine in terms of calculating myvalue , returning when getvalue called. when added in form, value in ext.form.textfield being returned, , have noticed myfield.getvalue not being called @ when formpanel.getform().submit() called on parent formpanel object.

i don't think can achieve you're trying without overriding lot more behavior.

if debug submit action, you'll see following in ext.form.action.submit:

ext.ajax.request(ext.apply(this.createcallback(o), {     form:this.form.el.dom,     url:this.geturl(isget),     method: method,     headers: o.headers,     params:!isget ? this.getparams() : null,     isupload: this.form.fileupload })); 

note passes actual form dom element (i.e. this.form.el.dom) contain field's actual value, not calculated value.

if continue debugging, you'll see within call ext.ajax.request form parameter gets serialized via ext.lib.ajax.serializeform(form). resulting serialized value passed ext.lib.ajax.request data parameter. value sent server.


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 -