views:

960

answers:

3

How do I get an extJS combo field to clear its 'value' when the display text is blank or doesn't match a list value, i.e. custom text not in the data store? I'm sure there must be something I'm missing, because such a simple feature can't make an otherwise impressive combo useless.

A: 

You can force to the list using forceSelection, also you might need to put an event on to capture the text value change and invalidate it if it's not in the store, perhaps the valid event I'm not sure.

Lloyd
@Lloyd, 'forceSelection' still allows a blank, which still keeps the previously selected 'value' property. I'm looking at using some ot other even to do a lookup for the 'display' text in the store, and reset the 'value' to null if not found.
ProfK
A: 

Just an idea. In a 'keydown' event do 'validate()' on each keystroke. Then use 'valid' and 'invalid' events to perform an appropriate action (f.e. setValue('')).

Thevs
+1  A: 

h t t p :// e x t j s . c o m /forum/showthread.php?t=68403

(remove the spaces, according to the system I'm too new here to post links in a decent way)