I have a tiny problem that drives me crazy for a few days. I have a form panel:
Ext.define('EC.view.PasswordPanel', { extend: 'Ext.form.Panel', alias: 'widget.pwdpanel', bodyPadding: 15, initComponent: function() { this.initialConfig = {url:'/password/'}; this.fieldDefaults = { labelAlign: 'right', labelWidth: 135, msgTarget: 'side', allowBlank: false, inputType: 'password' }; //this.listeners = { //// circumvent broken formBind //validitychange: function(comp, valid) { //this.down('button').setDisabled(!valid); //}}; this.buttons = [{ text: 'Change', formBind: true, scope: this, handler: function() { this.submit({ success: function(form, action) { Ext.Msg.alert( 'Success', '<p>Password change has been scheduled successfully.</p>' + EC.DELAY_NOTICE); form.reset(); }, failure: function(form, action) { if ('result' in action && 'msg' in action.result) { Ext.Msg.alert('Error', action.result.msg); } } }); } }]; this.items = [ { xtype: 'textfield', name: 'pw_old', fieldLabel: 'Old password' }, { xtype: 'textfield', name: 'pw_new1', id: 'pw_new1', fieldLabel: 'New password', minLength: 8, maxLength: 16 }, { xtype: 'textfield', name: 'pw_new2', fieldLabel: 'Confirm new password', } ]; this.callParent(arguments); } });
which I create on a tab from TabPanel:
{ title: 'Change Password', items: { xtype: 'pwdpanel' }, },
Now the check works fine, but the "Change" button is not disabled while the form is invalid. To be clear: when I click it, it does not go, but I feel that it should be turned off?
Am I doing something obvious wrong? Another form panel on the second tab works fine.
I can get around the problem using the listener that I commented on, but I understand that it should work without it.
PS Feel free to point out any nonsense / bad style, I am completely unfamiliar with ExtJS.