On 2 fév, 02:56, Stuart <[email protected]> wrote: > My use case: > > I have a TextBox which I want to validate onBlur. If validation fails, > I want to setFocus on it again. Which makes onBlur fire again, hence > the validation routine runs again (not ideal, in fact, a defect in my > mind). > > My code: > == snip == > public void onBlur(BlurEvent event) { > TextBox tb = (TextBox) event.getSource(); > try { > Long longValue = Long.valueOf(tb.getText()); > } catch (NumberFormatException e) { > // warn the user in the UI > // set the focus back on the TextBox > tb.setFocus(true); > }}
I think you have to defer the call to setFocus a bit anyway to make it work in all browsers (use a DeferredCommand or Scheduler.scheduleDeferred), it might solve your issue at the same time. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
