Here is the following form and i wanna access form`s apply button inside the form without using Ext.getCmp() and defining an id for the button:
{xtype : 'form',
url : 'index.php/submitform',
trackResetOnLoad : true,
id : 'generalprofilebasicinformation'+ this.getId(),
listeners : {
//is fired when the form is dirty(field values are modified)
dirtychange : {
fn : function(sm) {
//Here Is my problem:
//How to access to Apply button or any other buttons defined inside the form???
var applyButton = this.Button;
applyButton.enable();}}},
buttons : [{
text : 'Apply',
formBind : true, // only
// enabled
// once the
// form is
// valid
disabled : true,} ]}
You can use a controller to listen for the ‘dirtychange’ event fired by this form.
The answer darren gave will certainly work, this just utilizes component queries to give you a different way to reach and control components. If you wanted to enable a series of buttons within the form, for example, you could remove the ‘text=Apply’ and an array of all the forms buttons will be returned.