Table of Contents

Class MaximumLengthValidationRule

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

Rule validates that user input value is not longer than specified value.

public class MaximumLengthValidationRule : ValidationRule<string>
Inheritance
object
MaximumLengthValidationRule
Inherited Members
Extension Methods

Properties

MaximumLength

Maximum length user input is validated against.

[EditingComponent("Kentico.IntInput", Label = "{$kentico.formbuilder.validationrule.maximumlength.maximumlength.label$}")]
[Required]
public int MaximumLength { get; set; }

Property Value

int

Methods

GetTitle()

Gets a title for this instance of validation rule such as 'Maximum length is 100'.

public override string GetTitle()

Returns

string

Returns text describing the validation rule.

Validate(string)

Validates the form component's value and returns true if it is shorter or equal to the MaximumLength.

protected override bool Validate(string value)

Parameters

value string

Value of the form component.

Returns

bool

true if the value is valid, otherwise false.