The following validation rules are defined in this demo: Name: required, must be under 50 characters; Age: required, must be between 18 and 100; Email: required, must fit email regular expression; Arrival date: required
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):
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.