Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

How to set TextField readOnly attribute?


Apply the follwoing extension:
Code:

Ext.override(Ext.form.Field, {
    setReadOnly: function(readOnly) {
        if (readOnly == this.readOnly) {
            return;
        }
        this.readOnly = readOnly;

        if (readOnly) {
            this.el.dom.setAttribute('readOnly', true);
        } else {
            this.el.dom.removeAttribute('readOnly');
        }
    }
});

Now use like:

Ext.getCmp('user_id').setReadOnly(false);
Ext.getCmp('user_id').setReadOnly(true);
Advertisements

Comments are closed.

%d bloggers like this: