Friday, November 28, 2014

Re: SuggestBox and the underlying TextBox

I've done some really crappy and brittle code in an app where we delay the check for a few milliseconds when triggered by ValueChangeEvent, to let the time for the SelectionEvent to possibly be triggered.

But remember that this is a *suggest* box, not a "select box with type-ahead"; it gives suggestions (like Google Suggest, or your webmail searching your contacts list when typing in the "To:" or "Cc:" fields) but is otherwise free-form. Using the SuggestBox for a type-ahead listbox is misusing it; IMO you'd better look for another widget (and yes, there's no such widget in GWT proper), such as (never used it, can't really comment)

On Friday, November 28, 2014 8:25:20 AM UTC+1, ckuetbach wrote:

I have some trouble with the SuggestBox. 

There are at least two Hadler at the SuggestBox:

- ValueChangeHandler
- SelectionHandler

If I enter a Text into the SuggestBox and unfocus it, I get the ValueChangeEvent, with the current Value (I need to validate the Input at this moment)

If I enter a Text into the SuggestBox and select one of the Selection, I get two Events in this Order:

1. ValueChangeEvent with the SearchTerm of the TextBox
2. SelectionEvent with the selected Value

My Problem is, that my Validation will validate the SearchTerm in the ValueChangeEvent (Which may be wrong). In the following SelectionEvent, I get the correct Value. 
But in this case, I have already shown a warning Display, that the entered Value is invalid.

Are there any ideas, how I can solve my problem?


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment