[CLOSED] Override getValue() javascript function from numberField

  1. #1

    [CLOSED] Override getValue() javascript function from numberField

    Is there any way to override getValue() javascript function from numberField?

    It does this

        getValue : function(){
            return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)));
    i'm making a custom control inheriting from numberfield and i need to call another function before returning.
    Last edited by Daniil; Sep 02, 2010 at 4:12 PM. Reason: [CLOSED]
  2. #2

    You might want to look into using the .createInterceptorfunction, see


    This will allow you to insert custom logic before the function is called, or after will createSequence

    Hope this helps.
    Geoffrey McGill
    Founder & CEO
  3. #3
    That's not really what i want...
    I found out, browsing the documentation, that i can use Ext.extend to extend the javascript class, so i could do like:

    Ext.form.MyNumberField = Ext.extend(Ext.form.NumberField, {
    getValue: function() {
        return 1111;//test value, just to see if it works
    but it's been really hard to figure out how can i associate this extended javascript class to my server class,i mean, when i access my class in javascript i's still Ext.form.NumberField, not Ext.form.MyNumberField.
  4. #4
    If you are using markup and just want to override the .getValue function, you can use the following.


    <ext:NumberField ID="NumberField1" runat="server" GetValue="#(return this.getRawValue(); )" />
    The #() is a "function token" and automatically wraps the inner login in a function(){} template.

    Hope this helps.
    Geoffrey McGill
    Founder & CEO
  5. #5
    You can also override the .getValue function by setting a CustomConfig item.


    <ext:NumberField ID="NumberField1" runat="server">
            <ext:ConfigItem Name="GetValue" Value="#(return this.getRawValue(); )" />
    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. Replies: 2
    Last Post: Jun 06, 2012, 8:27 PM
  2. Replies: 12
    Last Post: Jan 05, 2012, 11:39 AM
  3. Replies: 1
    Last Post: Jun 29, 2011, 3:00 AM
  4. [CLOSED] Verify if a numberfield is empty in javascript.
    By pdcase in forum 1.x Premium Help
    Replies: 1
    Last Post: Sep 30, 2010, 8:25 PM
  5. [CLOSED] Javascript error on NumberField
    By jsemple in forum 1.x Premium Help
    Replies: 6
    Last Post: Sep 09, 2009, 3:56 PM

Posting Permissions