Ok, here is my problem. I have a selectfield with some options. The selectfield is used to filter my list. So in the selectfield there is filter by Discipline. When the user select it a discipline field which is currently hidden will show up, but when the user choose filter by student, the discpline field will hide itself and the student field (which is also hidden) will show instead. But I can't seem to figure the code out. Btw, I'm new to sencha touch. I'm using sencha touch 2.4.2. Here is my code :-
{
//first item of vbox(1)
xtype: 'container',
layout: 'hbox',
style: 'background-color:' + _ListHeaderColor() + '; color: floralwhite;',
margin: '10 10',
items: [
{
//first item of hbox
html: "Request List (Request Patient)",
margin: '15 15',
flex: 1
}, //end of first item of hbox
{
//second item of hbox
xtype: 'selectfield',
id: 'choose',
name: 'filter',
label: 'Filter By',
margin: '5 5',
width: '20%',
options: [
{ text: '-', value: 'none' },
{ text: 'Discipline', value: 'disc' },
{ text: 'Student', value: 'stud' },
],
listeners: {
change: function (field, newValue) {
if (value) {
var disp = Ext.getCmp(newValue).show();
var disp = Ext.getCmp(newValue).hide();
}
else {
var disp = Ext.getCmp(newValue).show();
var disp = Ext.getCmp(newValue).hide();
}
}
}
},
{
xtype: 'selectfield',
id: 'disc',
name: 'discipline',
label: 'Discipline',
margin: '5 5',
hidden: true,
store: _DataStore_RequestPatient,
displayField: 'text',
valueField: 'value'
},
{
xtype: 'searchfield',
id: 'stud',
name: 'student',
label: 'Students',
hidden: true
}
]
},
Well, you should provide the error messages you get. You should have found that
value is not defined
but this is just the tip of the iceberg. Out of courtesy, I have fixed up your code for you.