NJFInputValidationRules

export interface NJFInputValidationRules {
  allowEmpty: boolean;
  inputType: NJFInputTypeEnum;
  errorMessage?: string;
  minLength?: number;
  maxLength?: number;
  forbiddenCharacters?: string[];
  customRegex?: string;
  realtimeCustomRegex?: string;
  matchValueWith?: string;
  numberOperations?: {
    operation: NJFMathOperationEnum;
    number: number;
  }[];
}
PropertyTypeDescription
allowEmptyboolean*Whether the field can be empty or not.
inputTypeNJFInputTypeEnum*Input type.
errorMessagestring?Will replace the automatically generated messages from the validation rules function.
minLengthnumber?Minimum character length.
maxLengthnumber?Maximum character length.
forbiddenCharactersArray of string?Any character in that array will not be allowed in the field.
customRegexstring?Custom regular expression that will trigger an error for every character that triggers the expression.
realtimeCustomRegexstring?Custom regular expression that will prevent any of character that triggers the expression from being typed in the field (will not trigger an error). Better used in combination with customRegex.
matchValueWithstring?ID of the field that this field's value needs to match in order to pass validation. A common use case is for password and repeat password fields.
numberOperationsArray of Custom?Used only for number fields, array of mathematical operations that needs to be satisfied for the validation to pass. For example number of guests needs to be greater than 5 and less or equal than 8.

* = Required ? = Optional

numberOperations

PropertyTypeDescription
operationNJFMathOperationEnum*
numbernumber*