A TextBox which verifies that its content meets some conditions. This is used as the base class for DateTextBox.

Validation is performed as the user types by calling a validate() function. If the contents fail to pass validation, the control's invalid() method is invoked, which by default applies an "invalid" CSS class to the control.

The validation feedback is asymmetric, meaning that the text box will not reflect an invalid state until validation is enforced strictly. (By default, that happens when the focus leaves the control.) This allows the user to type without prematurely chastising them for entering invalid data. However, if the user corrects an invalid response, the invalid state is removed immediately after they type the character that fixes the data. In this way, the control is slow to complain, and quick to forgive. For more details on the motivation for asymmetric validation, see this user interface blog post .