PDA

View Full Version : Showing/Hiding Fieldset in a Form



thomyorke
4 Jan 2011, 11:23 AM
I'm trying to toggle a fieldset's HIDDEN property when a value of SELECTFIELD is toggled outside of this fieldset, but within the same form. Is this possible?



{
xtype: 'selectfield',
name : 'hazMat',
label: 'Haz Mat',
options: [
{text: 'No', value: 'no'},
{text: 'Yes', value: 'yes'}],
listeners:{
'change': function(){
if(this.value=='yes'){
// this.nextSibling().hidden = false; //this doesn't work (NEED HELP HERE)
}else{
// this.nextSibling().hidden = true; //this doesn't work (NEED HELP HERE)
}
}
}
}
]
},
{
xtype: 'fieldset',
hidden: true,
title: 'Haz Mat Information',
name: 'haz_fieldset',
instructions: 'Enter Haz Mat Information',
items:[
{
xtype: 'textfield',
label: 'Proper Shipping Name',
name: 'haz_name'
},
{
xtype: 'selectfield',
name: 'haz_class',
label: 'Class',
valueField: 'classValue',
displayField: 'classTitle',
store: storeHazClass
},
{
xtype: 'selectfield',
name: 'haz_subclass',
label: 'Sub-Class',
valueField: 'classValue',
displayField: 'classTitle',
store: storeHazClass
},
{
xtype: 'textfield',
label: 'UN Number',
name: 'haz_un_number'
}
]
}


Do I need to put an ID on the fieldset? How would I access this fieldset from the listener in my selectfield?