This page covers the types of validation available.

String Length Rule

The StringLengthRule has two properties: MinVal and MaxVal. If the MinVal is not set in the Table_ValidationPropertyValues table, it is treated as zero (0). On the edit form, all text areas associated with a StringLengthRule prevent the user from typing more than MaxVal characters.

Required Rule

The RequiredRule checks for an empty string if the field is of type string, or a null value otherwise. This rule prevents an empty Edit Form from being submitted. It has no properties.

RegEx Rule

The RegexRule does both client and server validation. To accomplish this, it has two properties: CSharpRegEx and JavaScriptRegEx. Before an edit form is submitted, the JavaScriptRegEx validates the form.

Uniqueness Rule

Unlike the other rules that work for all objects derived from a CartellaObject, this rule has an exception. This rule works on all objects derived from EntityBase (which derives from CartellaObject) or any field on a CartellaObject that exists in the default installation. In other words, in an Object derived from User, this rule will work on any field that exists on User. Use class CustomRule to perform Uniqueness Validation on an object that is not derived from EntityBase . This rule has no properties.

Custom Rule

The CustomRule is intended to be flexible enough for any business rule. It has one Property called MethodName. To implement a Custom rule, add a method to your type that takes an object as a parameter and returns a Boolean (type bool). The Custom rule is used in Cartella to provide pseudo-uniqueness validation on FolioModule labels. Since a Module’s label must be unique within a Folio and not unique to all modules, the FolioModule class has a method called ValidateLabelUniqueness. This function is found by the rule at run-time and is called on the object that is being validated. It is passed the value of the field, then validates uniqueness to its parent folio only.