Table of Contents

Class FormValidationRule<TProperties, TValue>

Namespace
Kentico.Forms.Web.Mvc
Assembly
Kentico.Content.Web.Mvc.dll

Base abstract class for form builder field validation rules.

public abstract class FormValidationRule<TProperties, TValue> : IFormValidationRule where TProperties : FormValidationRuleProperties, new()

Type Parameters

TProperties

The type of validation rule properties.

TValue

The type form field value.

Inheritance
object
FormValidationRule<TProperties, TValue>
Implements
Derived
SingleFieldFormValidationRule<TProperties, TValue>
Extension Methods

Remarks

This class should not be used directly. Instead, use derived classes such as SingleFieldFormValidationRule<TProperties, TValue> which provide specific validation functionality for form fields.

Constructors

FormValidationRule()

protected FormValidationRule()

Properties

LocalizationService

Gets the localization service used for retrieving localized strings.

protected ILocalizationService LocalizationService { get; }

Property Value

ILocalizationService

Properties

Gets the validation rule properties.

public TProperties Properties { get; }

Property Value

TProperties

Methods

GetDefaultErrorMessage()

Gets the default error message for the validation rule.

public virtual Task<string> GetDefaultErrorMessage()

Returns

Task<string>

GetProperties()

Gets the actual properties instance from the validation rule.

public FormValidationRuleProperties GetProperties()

Returns

FormValidationRuleProperties

SetProperties(FormValidationRuleProperties)

Sets the form validation rule properties.

public void SetProperties(FormValidationRuleProperties properties)

Parameters

properties FormValidationRuleProperties