Home Documentation Download License Contact

Field Validation

Validates data of M4.EmployModel.EmployField typically on events like ValueChanging or ValueChanged.
Allows you to aborts data changes or add an ValidationResult. The "Tree Employ Component" displays messages of validation results and adhere validation result properties not to save, close or delete a record.

Key FieldValidation
Defined In M4.ApplicationModel.AccessField
Multiple field validations can be defined. Implementation is optional.
Interface M4.ApplicationModel.IFieldValidation

EmployField M4.EmployModel.EmployField
Is set on validation before Validate() method is called.

Is called once after field data is read or new field is created. Add here handler for field events to apply validations on data changes.

NOTE: You can also inherit from M4.ApplicationModel.FieldValidation.
This abstract class implements M4.ApplicationModel.IFieldValidation with implementation of EmployField.
Standard Implementations Field Is Mandatory - M4.ApplicationModel.MandatoryValidation
Checks if field has value. Validation allows to define a validation message and to set a flag to deny saving, if field is empty.

Field Value Matches Regular Expression - M4.ApplicationModel.RegularExpressionValidation
Checks if field matches a regular expression. You can define the regular expression, case sensitivity and if you allow empty fields. Validation allows to define a validation message and to set a flag to deny saving.

Field Value Is Valid E-Mail Address - M4.ApplicationModel.EMailValidation
Checks if field is a valid E-Mail address. Inherits M4.ApplicationModel.RegularExpressionValidation. Uses predefined regular expression for E-Mail validation.

Copy Modified Value To Another Field - M4.ApplicationModel.CopyValidation
Modifies and copies data to another field. Has properties to define the name of the other field, and a list of values to replace. Set OnlyNumericValues to true to only copy numbers.
This validation is used to copy a numbers only copy of phone numbers.
Example M4CustomLibrary.Validations.ExcludeStringValidation
Has a property to define a certain string, that is not valid.