PDA

View Full Version : Disabling fields on disabled panel



alex007
1 Apr 2011, 8:07 AM
Hi all,

I have to following problem: I have checkbox and tab panel. When the checkbox is unckecked I wont to disable the tab panel 'tab1', but when I try to submit the form validator says that I didn't fill 'field1'. How can I remove checks on disabled panels?

here is my code:



var tab1 = new Ext.Panel({
title: 'Tab1',
layout: 'form',
defaultType: 'textfield',
defaults: {anchor: '95%'},
border:false,
disabled: true,
items:[
{
name: 'field1',
fieldLabel: 'Field1',
allowBlank: false,
maskRe: /[-.\d]/
}
]
});

var form = new Ext.FormPanel({
labelAlign: 'top',
bodyStyle:'padding:5px',
fileUpload: true,
encoding:'multipart/data',
width: 700,
autoHeight: true,
items: [
{
id: 'chrckbox1',
xtype: 'checkbox',
name: 'Checkbox1',
fieldLabel: 'Enable tab1',
listeners: {
render: function(p) {
p.getEl().on('click', function(){
if(Ext.get('chrckbox1').getAttribute('checked')){
tab1.enable()
}else{
tab1.disable()
}
});
}
}
},
{
xtype: 'fieldset',
title: '<?= __('Details') ?>',
collapsible: true,
collapsed: true,
items: Ext.TabPanel({
activeTab: 0,
width:'100%',
plain:true,
defaults:{autoHeight: true},
items:tab1new
})
}
]
});


var window1 = new Ext.Window({
title: '<?= __('Creating a New tag') ?>',
closable:true,
autoWidth: true,
autoHeight: true,
modal: true,
plain:true,
layout: 'fit',
items: form
});
window1.show();