PDA

View Full Version : problem about three combobox cascading



big
22 Feb 2010, 5:36 AM
when i choose second combobox ,it not get value to compare with php for sent value to third combobox.


Ext.onReady(function() {
var makesStore=new Ext.data.JsonStore({
url: 'combobox.php',
baseParams:{cmd:'makes'},
root: 'makes',
fields: ['p_code', 'p_name_t']
});
var modelsStore=new Ext.data.JsonStore({
url: 'combobox.php',
baseParams: { cmd:'makes'},
root: 'makes',
fields: ['a_code', 'a_name_t']
});
var tumbolStore=new Ext.data.JsonStore({
url: 'combobox.php',
baseParams: { cmd:'makes'},
root: 'makes',
fields: ['t_code', 't_name_t']
});

var MakeCombo=new Ext.form.ComboBox({
xtype: 'combo',
store: makesStore,
id:'pcode',
displayField: 'p_name_t',
valueField: 'p_code',
typeAhead: true,
editable: false,
mode: 'remote',
forceSelection: true,
triggerAction: 'all',
fieldLabel: 'Make',
emptyText: 'Select a make...',
selectOnFocus: true,
anchor:'95%',
listeners: {
'select': function(cmb, rec, idx) {
modelsCbx=Ext.getCmp('acode');
modelsCbx.clearValue();
modelsCbx.store.load({
params: { pcode: cmb.getValue() }
});
modelsCbx.enable();
}
}
});
var ModelCombo=new Ext.form.ComboBox({
xtype: 'combo',
id:'acode',
store: modelsStore,
displayField: 'a_name_t',
valueField: 'a_code',
typeAhead: true,
editable: false,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
fieldLabel: 'Model',
emptyText: 'Select a model...',
selectOnFocus: true,
disabled: true,
anchor: '95%',
listeners: {
'select': function(cmb, rec, idx) {
modelsCbx=Ext.getCmp('tcode');
modelsCbx.clearValue();
modelsCbx.store.load({
params: {
pcode: cmb.getValue(),
acode: cmb.getValue()

}
});
modelsCbx.enable();
}
}

});

var TumbolCombo=new Ext.form.ComboBox({
xtype: 'combo',
id:'tcode',
store: tumbolStore,
displayField: 't_name_t',
valueField: 't_code',
typeAhead: true,
editable: false,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
fieldLabel: 'Tumbol',
emptyText: 'Select a model...',
selectOnFocus: true,
disabled: true,
anchor: '95%',

});
var newCarForm=new Ext.FormPanel({
frame: true,
title: 'Car Reviews',
bodyStyle: 'padding:5px',
width: 420,
id: 'make-selector-frm',
url: 'new-car.php',
items: [
MakeCombo, ModelCombo,TumbolCombo
],
buttons: [{
text: 'Go',
handler: function() {
Ext.getCmp('car-selector-frm').getForm().submit();
}
}, {
text: 'Cancel',
handler: function() {
}
}]
});
newCarForm.render(document.body);
});

big
22 Feb 2010, 6:38 AM
i'm sorry everybody. my code is true. it's incorrect in php.