The built-in validation framework works for all objects derived from CartellaObject.

To add validation to custom types, follow these steps:

Add an entry to the Table_EditFormDefinition_Main table

This must be the fully qualified name of the class being implemented (i.e. "Cartella.Classes.Category").

Add an entry to the Table_EditFormDefinition_Fields Table

The FieldName is the name of the column associated with the objects record. ObjectPropertyName is the name of the C# property associated with the field. FieldType is used by the Edit Form to know what type of control to display to the user. Valid values are:

  • Text

  • HTML

  • Hidden

  • Document

  • Image

FieldLabel is the label displayed on the Edit Form.

The following fields have been deprecated:

  • IsRequired

  • EmpyFieldMessage

  • FormatExpression

  • InvalidFormatMessage

They have been replaced with the validation framework.

Add Rules to the Field

Add Validation Rules to the Table_EditFormFieldValidation table. The ID_ValidationType must reference one of the built in validation types. They can be found in the Table_ValidationType table.

The NotValidMessage column is for the message that will be displayed to the user if a localized message can not be found.

Add property values to the rules

If a Validation Rule has properties, the property values must be added to the Table_ValidationPropertyValues table. For instance, enter the Regex used for validating a phone number, email, or other field. It is also the place to enter the maximum length for a string.