PDA

View Full Version : [SOLVED]Showing a hidden field after clicking on radio button



Czapla
10 Feb 2010, 9:58 AM
Like in topic

I have a 2 radio buttons and field with set hidden: true, after clicking on NO i should display hidden field.
How can i do this?
I'm trying smth like this, but not working


{
xtype: 'radio',
name: 'srt_stan',
hideLabel: false,
boxLabel: 'YeS'
},{
xtype: 'radio',
name: 'srt_stan',
boxLabel: 'NO',
handler: function () {
var checkHandler = function(radio, checked){
if (checked){
pokapoka.show();
} else {
pokapoka.hide();
}
}
}
},{
xtype: 'datefield',
store: pokapoka,
fieldLabel: 'Date',
name: 'srt_data',
hideLabel:true,
hidden: true,
allowBlank: false
}],


Cheers

Ty for your help Eugen_ :)

Eugen_
10 Feb 2010, 10:31 AM
something like this


xtype: 'radio',
name: 'srt_stan',
boxLabel: 'NO',
listeners: {
'check' : function(radio, checked) {
/* if you use an Ext.form.FormPanel */
nameOfYouFormPanel.getBaseForm().findField('srt_data').setVisible(checked);
/* if you use an Ext.Panel you need to add "id: 'srt_data'" to your Ext.form.DateField */
Ext.getCmp('srt_data').setVisible(checked);
}
}