PDA

View Full Version : Enable/Disable button on toolbar



jiindal1988
6 Dec 2011, 9:56 PM
Hello, I have a textarea on my panel and a button on the toolbar.

Initially I want to keep that button disabled (as there is no text in the textarea when the panel loads), so I have set disabled property to true. Now, as soon as user starts typing in textarea, I want to enable that toolbar button.

How can I enable/disable toolbar button based on the text in textarea field.

Any help is Appreciated.

mitchellsimoens
9 Dec 2011, 10:56 AM
You need to use ComponentQuery a couple of times. One to get from the textarea to the parent panel and one to go from the panel to the button....



var panel = textarea.up('panel'),
button = panel.down('button');

If you have more than one button then I would suggest adding an action property to the button (action isn't used by the framework) and then the panel.down you can do panel.down('button[action=submit]')