PDA

View Full Version : Disable textbox programmatically



mgoodi
29 Jun 2016, 4:50 PM
How can I disable a textbox programmatically?

I have:

var yob = Ext.getCmp('date_of_birth_year');

But this won't work:

yob.disabled = true;

Jad
29 Jun 2016, 10:40 PM
Hy

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Text-method-disable

josei
30 Jun 2016, 3:11 AM
Try


yob.setDisabled(true);

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Text-method-setDisabled

(http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Text-method-setDisabled)FIDDLE:
https://fiddle.sencha.com/#fiddle/1cu9

mgoodi
30 Jun 2016, 12:03 PM
Thanks Jad! I saw this, but I wasn't able to get it to work. Looks like I was referencing the property wrong.

mgoodi
30 Jun 2016, 12:04 PM
Thanks josei! That worked!