change of focus and "no empty" constraint

asked 2008-08-25 20:40:07 +0800

dastultz gravatar image dastultz
797 8

Suppose I have a form with 2 textboxes with "no empty" constraints. The textboxes bind to a bean. When the user is on the second field I want the pressing of Enter to add a new record, reset the fields to blank, then switch the focus to the first textbox. The resetting of the the fields is done by clearing the values in the bean and calling binder.loadAll(), followed by firstTextbox.focus(). It seems this last action triggers the "no empty" constraint on the second textbox.

This seems like a common data-entry pattern. Is there some way to change the focus without triggering the "no empty" constraint?


delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2008-08-25 20:54:42 +0800

dastultz gravatar image dastultz
797 8

I think I've got it. I followed a tip from "How to let textbox clean when save":

textboxTwo.setConstraint((Constraint) null);
textboxTwo.setConstraint("no empty");


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2008-08-25 20:40:07 +0800

Seen: 226 times

Last updated: Aug 25 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More