PDA

View Full Version : EventListener for fieldset



paulr
30 Aug 2010, 1:45 AM
Hey there,
i am wondering whether it is possible for me to know whether a fieldset's checkboxToggle has been clicked or not?

i want to know whether the checkbox is ticked or not when submit button is pressed.

var fsf = new Ext.FormPanel({
labelWidth: 75, // label settings here cascade unless overridden
url:'save-form.php',
frame:true,
title: 'Simple Form with FieldSets',
bodyStyle:'padding:5px 5px 0',
width: 350,

items: [{
xtype:'fieldset',
checkboxToggle:true,
title: 'User Information',
autoHeight:true,
defaults: {width: 210},
defaultType: 'textfield',
collapsed: true,
items :{
fieldLabel: 'First Name',
name: 'first',
allowBlank:false
},{
fieldLabel: 'Last Name',
name: 'last'
},{
fieldLabel: 'Company',
name: 'company'
}, {
fieldLabel: 'Email',
name: 'email',
vtype:'email'
}
]
}
});


//assume there is a submit button here

fsf.render(document.body);

Thanks in advance

j-joey
30 Aug 2010, 7:11 AM
CheckBox on FieldSet just expands and collapses the container. So you can bind listeners to expand and collapse events.

Also you can reach to checkbox dom object query it for checked status by MyFieldSet.checkbox.dom.checked

j-joey
30 Aug 2010, 7:14 AM
one more thing.

if you want to exclude fields in a collapsed fieldset when submitting you can bind disable it when collapsed