Skip to content

FormValidationAttribute class

namespace: Serenity.ComponentModel   assembly: Serenity.Net.Core

Makes the save handlers also validate by a form what they save, i.e. what the form checks in the browser that the row doesn't: its own RequiredAttributes, RequiredWhenAttributes and validation rules, like ValidateRangeAttribute, skipping the fields the form hides or makes read only, as the browser does. It can be on a save handler, or on a row for the handlers that have none, and a handler can choose a form by its own logic instead, e.g. by overriding its GetValidationForm, when an entity has more than one.

[AttributeUsage(AttributeTargets.Class)]
public class FormValidationAttribute : Attribute
parameter description
formType The type of the form, e.g. typeof(CustomerForm).

Public Members

name description
FormValidationAttribute(…) Makes the save handlers also validate by a form what they save, i.e. what the form checks in the browser that the row doesn't: its own RequiredAttributes, RequiredWhenAttributes and validation rules, like ValidateRangeAttribute, skipping the fields the form hides or makes read only, as the browser does. It can be on a save handler, or on a row for the handlers that have none, and a handler can choose a form by its own logic instead, e.g. by overriding its GetValidationForm, when an entity has more than one.
FormType { get; } Gets the type of the form.

See Also