Table of Contents

Class DateInFutureValidationRule

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

Validation rule for checking that date and time values are in the future.

[ValidationRuleAttribute(typeof(DateInFutureValidationRuleAttribute))]
public class DateInFutureValidationRule : ValidationRule<DateInFutureValidationRuleProperties, DateInFutureValidationRuleClientProperties, DateTime?>, IValidationRule
Inheritance
object
DateInFutureValidationRule
Implements
Inherited Members
Extension Methods

Remarks

Can be used with the DateTimeInputComponent and components. For DateTime inputs, accepts values up to 10 minutes before the current time so that users can finish submitting the form.

Constructors

DateInFutureValidationRule(ILocalizationService)

Creates a new instance of DateInFutureValidationRule class.

public DateInFutureValidationRule(ILocalizationService localizationService)

Parameters

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(DateInFutureValidationRuleClientProperties)

Allows set validation rule client properties.

protected override Task ConfigureClientProperties(DateInFutureValidationRuleClientProperties clientProperties)

Parameters

clientProperties DateInFutureValidationRuleClientProperties

Current instance of client properties.

Returns

Task

Validate(DateTime?, IFormFieldValueProvider)

Validates value and returns the validation result.

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

Parameters

value DateTime?

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.