PDA

View Full Version : How to validate a combo textbox value is a selected item?



bryanevil
19 Jul 2010, 6:58 PM
I have this combo box in my form. How do i validate its value is a selected item (not any other hand-typed value)?

I dont want to disable the text field since I want user able to benefit from the auto search when hand typing.


new Ext.form.ComboBox({
fieldLabel: 'Supplier Name',
store: SupplierDropDownStore,
displayField: 'SupplierName',
valueField: 'ID',
lazyInit: true,
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText: 'Select a Supplier...',
loadingText: 'Loading Suppliers...',
selectOnFocus: true,
listeners: {
select: function (combo, record, index) {
//var s = .get('SupplierId');

var v = combo.getValue();
this.getForm().get('orderform_supplierId_txtfield').value = v;
// $('#orderform_supplierId_txtfield').val(v);
}
}//listener
})

bryanevil
20 Jul 2010, 12:46 AM
I used an Alternative way. forceSelection: true to force textbox must be a binded value