Tim Mitchell
Tim Mitchell

Reputation: 663

Using getElementById to disable an Ext.Button

I have some javascript in which I need to get an Ext.Button object by its id, and then disable it.

I can do this with an Ext.form.TextField, but not with an Ext.Button object.

Even if I do it like this...

var coeiTextField = new Ext.Button({
    text: 'My Button'
    width:110,
    id: 'my_button',
    disabled: false,

});

and then do...

document.getElementById("my_button").disabled=true;

It never works. I know my code is basically right because it works if I do it with an Ext.form.TextField - just not an Ext.Button.

Any suggestions?

Thanks!

Upvotes: 0

Views: 100

Answers (1)

Ben
Ben

Reputation: 1368

Use the disable method.

coeiTextField.disable();

If you want to query the button,

var button = Ext.getCmp('my_button');

button.disable();

Upvotes: 2

Related Questions