Class ValidationRule<TValue>
Represents a base class for a form component validation rule. Inherit this class to create custom validation rules.
[Obsolete("This API is only available for legacy Form Builder components that provide backward compatibility when transitioning from older versions. The API will be removed when support for the Form Builder compatibility mode is dropped. Update your components to the new validation rules framework. See SingleFieldFormValidationRule.")]
public abstract class ValidationRule<TValue> : ValidationRule
Type Parameters
TValueType of value which is supposed to be validated by this rule
- Inheritance
-
objectValidationRule<TValue>
- Derived
- Inherited Members
- Extension Methods
Constructors
ValidationRule()
protected ValidationRule()
Methods
IsValueValid(object)
Validates the form component's value and returns true if the value is valid.
This method is used by system.
public override sealed bool IsValueValid(object value)
Parameters
valueobjectValue of the form component.
Returns
- bool
trueif the value is valid, otherwise false.
Validate(TValue)
Wrapped by IsValueValid(object) which converts the value to type specified by the generic type. Override this method to apply desired validation.
protected abstract bool Validate(TValue value)
Parameters
valueTValueValue of the form component.
Returns
- bool
trueif the value is valid, otherwise false.