1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    111
    Answers
    5
    Vote Rating
    0
    sissonb is on a distinguished road

      0  

    Default Unanswered: Update Ext.form.Text inputCls

    Unanswered: Update Ext.form.Text inputCls


    I have a text form and want to update the inputCls property on keyup. This is how I am currently trying, but it's wrong.

    Code:
    new Ext.form.Text({            
                name : 'referredFrom',
                id : 'referredFrom',
                inputCls:"invalid",
                label: 'Account Number',
                listeners:{
                    keyup:function(){
                        
                        var isValid = true;
                        if(isValid){
                            Ext.getCmp("referredFrom").inputCls = "valid";                        
                        }
                        else{                        
                            Ext.getCmp("referredFrom").inputCls = "invalid";
                        }
                    }
                }
            });
    Any Ideas?
    Thanks

  2. #2
    Sencha User
    Join Date
    Feb 2011
    Posts
    111
    Answers
    5
    Vote Rating
    0
    sissonb is on a distinguished road

      0  

    Default


    Currently I am doing it this way, but really don't like the solution.
    Code:
    new Ext.form.Text({
                name : 'referredFrom',
                id : 'referredFrom',
                label: 'Account Number',
                listeners:{
                    keyup:function() {
    
    
                        if (this.getValue() === "") {
                            var defaultClass = "x-input-text";
                            Ext.getCmp("referredFrom").el.dom.children[1].children[0].setAttribute("class", defaultClass);
                        }
                        else {
                            var unknownClass = "x-input-text unknown";
                            Ext.getCmp("referredFrom").el.dom.children[1].children[0].setAttribute("class", unknownClass);
                        }
                    }
                }
            });
    If there is a better way please let me know.
    Thanks