Prevent Edit of a Combo Box
Posted on 2002-06-03
I have several combo boxes in an application I'm working on. I don't want to allow the users to just type something into the combo box - infact - I want them to be able to select ONLY a list item in the combo box.
I am still not sure if I want to allow them to type in the field (and catch the case where the typed value does not exist in the list) or to completely stop typing in the field. My personal preference (and from what I can tell the easier of the two options) would be the later.
I've played with validate, and lost focus. They don't quite behave how I want them to. For example, a user could type in string, click the continue button. This would call the lost_focus event which would determin that the string was bad, set the combo to some value (user would have no control of this) and then continue on...
Any ideas/code fragments greatly appriecated.