1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    7
    Vote Rating
    0
    KCSureShot is on a distinguished road

      0  

    Default Number Field validation

    Number Field validation


    I am building a banking app using Sencha Touch. I have a Number Field on the screen that allows the user to type in a amount. I see no way to force numeric entry only, or to apply a mask to the box so that they type in numbers and it fills in from right to left auto inserting decimal. I see I can work with the keyup event. However keyup is too late. I need access to a keydown event. I'm not sure why Sencha chose to not include the keydown event in their Number Field. Does anyone know how this can be accomplished?

    Thanks

    KCSureShot

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    7
    Vote Rating
    0
    KCSureShot is on a distinguished road

      0  

    Default SOLVED

    SOLVED


    Code:
    accountToAmountBox = new Ext.form.Number({
        inputType: 'number',
        cls: 'accountToAmountBox',
        initEvents: function () {
            Ext.form.Number.superclass.initEvents.call(this);
            var keyDown = function (e) {
                    if (notNumber(e.browserEvent.keyCode)) {
                        e.browserEvent.preventDefault();
                    }
                    this.el.on("keydown", keyDown, this);
                },
                label: 'Amount', labelWidth: '100%', labelAlign: 'top', required: 'true'
        });
    The code inside my keydown function could be whatever you like. The point is this causes that event to fire and your function to get called.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar