Hi,
I had a quick question about the Ext.form.ComboBox assertValue private function. The source, at least for my version is here:
Code:
assertValue : function(){
var val = this.getRawValue(),
rec;
if(this.valueField && Ext.isDefined(this.value)){
rec = this.findRecord(this.valueField, this.value);
}
if(!rec || rec.get(this.displayField) != val){
rec = this.findRecord(this.displayField, val);
}
if(!rec && this.forceSelection){
if(val.length > 0 && val != this.emptyText){
this.el.dom.value = Ext.value(this.lastSelectionText, '');
this.applyEmptyText();
}else{
this.clearValue();
}
}else{
if(rec && this.valueField){
// onSelect may have already set the value and by doing so
// set the display field properly. Let's not wipe out the
// valueField here by just sending the displayField.
if (this.value == val){
return;
}
val = rec.get(this.valueField || this.displayField);
}
this.setValue(val);
}
},
My question specifically has to do with these lines:
Code:
if(val.length > 0 && val != this.emptyText){
this.el.dom.value = Ext.value(this.lastSelectionText, '');
this.applyEmptyText();
}else{
this.clearValue();
}
Does it make sense for the assertion function to be doing the actual clearing? I'm in the process of adding a 'clear' event to be fired from the body of this code, as I want some other classes to be notified when this field clears itself. I wondered that I did not find the clearing done in either TextField's 'applyEmptyText' function, or in the Combobox 'clearValue' function, rather than here.
If y'all feel it's legit, no worries; just curious.