Table of Contents

Class DecimalFormatValidationRule

Namespace
Kentico.Xperience.Admin.Base.Forms
Assembly
Kentico.Xperience.Admin.Base.dll

Validation rule for decimal numbers checking size and precision

public sealed class DecimalFormatValidationRule : ValidationRule<DecimalFormatValidationRuleProperties, DecimalFormatValidationRuleClientProperties, decimal?>, IValidationRule
Inheritance
object
DecimalFormatValidationRule
Implements
Inherited Members
Extension Methods

Constructors

DecimalFormatValidationRule(VariableFormComponentProperties, ILocalizationService)

Creates a new instance of DecimalFormatValidationRule class.

public DecimalFormatValidationRule(VariableFormComponentProperties properties, ILocalizationService localizationService)

Parameters

properties VariableFormComponentProperties
localizationService ILocalizationService

Properties

ClientRuleName

Gets the client rule name identifier.

public override string ClientRuleName { get; }

Property Value

string

DefaultErrorMessage

Defines default error message of the validation rule.

protected override string DefaultErrorMessage { get; }

Property Value

string

Methods

ConfigureClientProperties(DecimalFormatValidationRuleClientProperties)

Allows set validation rule client properties.

protected override Task ConfigureClientProperties(DecimalFormatValidationRuleClientProperties clientProperties)

Parameters

clientProperties DecimalFormatValidationRuleClientProperties

Current instance of client properties.

Returns

Task

Validate(decimal?, IFormFieldValueProvider)

Validates value and returns the validation result.

public override Task<ValidationResult> Validate(decimal? value, IFormFieldValueProvider formFieldValueProvider)

Parameters

value decimal?

Value to be validated.

formFieldValueProvider IFormFieldValueProvider

Provider of values of other form fields for contextual validation.

Returns

Task<ValidationResult>

Returns validation result with IsValid set to true, if value is valid. Otherwise returns result with the flag set to false and a corresponding error message.