Skip to main content

Input Validation

  • 2 minutes to read

Data Validation takes place when a user specifies an editor’s value which is assigned to the BaseEdit.EditValue property. The editor does not accept a new value if the value is invalid. In this case, the editor temporarily stores the invalid value until a user will correct or reset it. An editor displays an error icon with a tooltip that shows the error message. You can use the BaseEdit.ClearError method to reset invalid values when the ESC key is pressed.

validation

Validation Types

Editors support automatic and event-based validation types. Automatic validation uses masks to control user input. Refer to the following documentation topic for more information on the automatic validation: Masked Input

You can use BaseEdit.ValidateOnTextInput and BaseEdit.ValidateOnEnterKeyPressed properties to specify whether data validation should take place, when the ENTER key is pressed after text is modified, or when an attempt is made to move focus away from the editor after text is modified).

Event-Based Validation

You can handle the BaseEdit.Validate event to enable manual validation. In this case, you can check the editor’s value before it is accepted. If the entered value does not meet your requirements you can indicate that the value is invalid.

The BaseEdit.Validate event is raised for an editor if the editor’s BaseEdit.CausesValidation property is set to true. Editor validation can fire in the following cases:

You can also use the BaseEdit.DoValidate method to validate an editor value at any time.

Set the IsValid property of the BaseEdit.Validate event’s argument to false to indicate that the edit value has failed validation.