Aug 04, 2015, 8:18 AM
[CLOSED] ComboBox Validation
Good Morning all
we got a Combobox implementation similar to your example here : https://examples3.ext.net/#/Form/ComboBox/Custom_Search
Because our customer has very special needs :-/ We need to inform the user that his entry doesn't match to a record (in your example type in 'test' and you wont find a record).
My idea: attach a Listener to the Blur event, check the Value and inform the User.
My JS Code looks like this
Can I change that ?
Kind Regards
Peter
we got a Combobox implementation similar to your example here : https://examples3.ext.net/#/Form/ComboBox/Custom_Search
Because our customer has very special needs :-/ We need to inform the user that his entry doesn't match to a record (in your example type in 'test' and you wont find a record).
My idea: attach a Listener to the Blur event, check the Value and inform the User.
My JS Code looks like this
var validateCodeComboBox = function (record, item, config) {
if (!_pageLoaded)
return;
var data = record.store.data.items;
var control = Ext.getCmp(record.id);
if (record.rawValue === '') {
control.inputEl.setStyle({ // Die Daten in der Combobox wurde auf 'leer' gesetzt.
"background-image": 'none',
"background-color": 'white'
});
return;
}
var foundInStore = data.any(function (t) { return t.data.text === record.rawValue });
if (!foundInStore) {
control.inputEl.setStyle({
"background-image": 'none',
"background-color": 'red'
});
alert('Bad Code selected');
control.focus();
} else {
control.inputEl.setStyle({
"background-image": 'none',
"background-color": 'white'
});
}
control.focus();
};
The Code works, but when I leave the ComboBox with a TAB Jump the Focus is always set to the next control on the form ?!Can I change that ?
Kind Regards
Peter
Last edited by fabricio.murta; Aug 06, 2015 at 11:28 AM.
Reason: [CLOSED]