This demo illustrates the built-in flexibility and efficiency of our MVC data validation engine, allowing you to easily implement different validation scenarios. Validation settings can be customized for a given editor by using the editor's ValidationSettings property.
To define editor validation logic, use the following (can be combined together whenever required):
- The RequiredField property can be used to force an editor to require input and give you the ability to display an error message if input is not received.
- The RegularExpression property allows you to validate an editor's value based upon a regular expression.
- An editor's Validation client event can be handled to setup custom editor validation. Review the code sample tabs within this demo, to learn how easy this really is.
Editor validation is automatically triggered by changing the editor's value whenever the ValidationSettings.ValidateOnLeave option is enabled. You can manually initiate editor validation by using the editor's Validate client method or specific static client methods (such as the ValidateEditorsInContainer, ValidateEditorsInContainerById, ValidateGroup).
When an editor fails validation logic, a specific error frame containing the error’s description can be displayed. The Display property controls how the error frame occupies space around the editor. The error frame's appearance is customized via the ErrorFrameStyle property. Based upon ErrorDisplayMode settings, the description of an error can be represented within the error frame using an error image or text (or both). To define an error image, use the ErrorImage property. The error text can be specified by using either the ErrorText property or in the Validation event's handler.
See Also: Binding Data Editors to Data