Validators

Effortlessly manage and validate forms in Vue.js with the useForm composition API function and built-in validation from "@tidy".

Aplicable to All

notEmpty

The notEmpty validator ensures the user enters a value in the field and disallows whitespace characters. The parameter object is BaseValidatorConfig.

// conditionalExpression
Validators.notEmpty({conditionalExpression:(x,y) => x.firstName == "Bharat"  });
// messageKey
Validators.notEmpty({messageKey:'notEmptyMessageKey' });
// message
Validators.notEmpty({message:'Username cannot be blank.' });

required

A required validator ensures the user enters a value in the associated property. The parameter object is BaseValidatorConfig.

// conditionalExpression
Validators.required({conditionalExpression:(x,y) => x.firstName == "Bharat"  });
// messageKey
Validators.required({messageKey:'requiredMessageKey' });
// message
Validators.required({message:'Username cannot be blank.' });

requiredTrue

The requiredTrue validator is specifically used for checkbox fields within a form. It verifies that the user has checked the box, meaning the value should be true. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.requiredTrue({conditionalExpression:(x,y) => x.isAgree == true });
// messageKey
Validators.requiredTrue({messageKey:'requiredTrueMessageKey' });
// message
Validators.requiredTrue({message:'Should be active' });

Array

allOf

The allOf validation function ensures that a user has entered all of the specified values for a given field. The passing parameter type is ArrayConfig.

Code Example

// matchValues
Validators..allOf({ matchValues: ["ECommerce", "Banking"] })
// conditionalExpression
Validators.allOf({matchValues: ["MVC","C#","SQL Server"], conditionalExpression: x => x.department =='DotNet'})
// messageKey
Validators.allOf({ matchValues: ["English", "Spanish", "French"], messageKey: 'allOfMessageKey' })
// message
Validators.allOf({matchValues:["Drawing"],message: "Please select all hobbies"})

noneOf

The noneOf validation function ensures that none of the values specified in an array match the user's input for a given field. It performs a logical NOT operation on the provided values. The passing parameter type is ArrayConfig.

// matchValues
Validators.noneOf({matchValues:["ECommerce", "Banking","Educational","Gaming"]})
// conditionalExpression
Validators.noneOf({matchValues:["Secondary","Senior Secondary","B.Tech","M.Tech","B.C.A.","M.C.A."], conditionalExpression: (x,y) => x.department =='DotNet'})
// messageKey
Validators.noneOf({ matchValues: ["English", "Spanish", "French"], messageKey: 'noneOfMessageKey' })
// message
Validators.noneOf({matchValues:["Drawing", "Singing","Dancing","Travelling","Sports"],message: "Please do not select any hobby"})

oneOf

The oneOf validation function ensures that the user's input for a given field matches exactly one of the values specified in an array. The passing parameter type is ArrayConfig.

// matchValues
Validators.oneOf({matchValues:["ECommerce", "Banking","Educational","Gaming"]})
// conditionalExpression
Validators.oneOf({matchValues:["Secondary","Senior Secondary","B.Tech","M.Tech","B.C.A.","M.C.A."], conditionalExpression: (x,y) => x.department =='DotNet'})
// messageKey
Validators.oneOf({ matchValues: ["English", "Spanish", "French", "German", "Chinese"], messageKey: 'oneOfMessageKey' })
// message
Validators.oneOf({matchValues:["Drawing", "Singing","Dancing","Travelling","Sports"],message: "Please select atleast 1 hobby"})

Custom

Compose

Pattern

The pattern validation function ensures that the user's input for a given field adheres to a predefined pattern. It leverages regular expressions to perform this validation. The passing parameter type is PatternConfig.

// expression
Validators.pattern({expression:{'onlyAlpha': /^[A-Za-z]+$/} });
// conditionalExpression
Validators.pattern({expression:{'onlyDigit': /^[0-9]*$/}  ,conditionalExpression:'x => x.userName=="Bharat"' });
// messageKey
Validators.pattern({expression:{'pinCode':/^[1-9][0-9]{5}$/ }  ,messageKey:'patternMessageKey' });
// message
Validators.pattern({expression:{'zipCode':/^[0-9]{5}(?:-[0-9]{4})?$/ }  ,message:'Zip code should match 12345 or 12345-6789' });

Date and Time

Date

Date validation validator will allow user to enter input which is only in the proper date format. The passing parameter type is DateConfig.

// allowISODate
Validators.date({allowISODate:true });
// conditionalExpression
Validators.date({conditionalExpression:(x,y) => x.birthDate == "16/04/1997"  });
// messageKey
Validators.date({messageKey:'dateMessageKey' });
// message
Validators.date({message:'{{0}} is not a valid date' });

maxDate

maxDate validation validator will allow user to enter the date less than the maxDate value parameter. The passing parameter type is MaxDateConfig.

// fieldName
Validators.maxDate({fieldName:'enrollmentDate' });
// conditionalExpression
Validators.maxDate({value:'07/30/2018'  ,conditionalExpression:(x,y) => x.userName == "Bharat"  });
// messageKey
Validators.maxDate({value:'07/30/2018'  ,messageKey:'maxDateMessageKey' });
// message
Validators.maxDate({value:'07/30/2018'  ,message:'{{0}} exceeds the Maximum Date Limit' });

minDate

minimum Date validation validator will allow user to enter date greater the minimum date value parameter. The passing parameter type is MinDateConfig.

// fieldName
Validators.minDate({fieldName:'enrollmentDate' });
// conditionalExpression
Validators.minDate({value:'07/30/2018'  ,conditionalExpression:(x,y) => x.userName == "Bharat"  });
// messageKey
Validators.minDate({value:'07/30/2018'  ,messageKey:'minDateMessageKey' });
// message
Validators.minDate({value:'07/30/2018'  ,message:'{{0}} exceeds the Minimum Date Limit' });

minTime

minTime validation validator will allow user to enter the input time format which must be strictly greater than or greater than or equal to the minimum time mentioned in the config parameters. The passing parameter type is MinTimeConfig.

// allowSeconds
Validators.minTime({allowSeconds:true  ,value:'00:10:00' });
// fieldName
Validators.minTime({ fieldName:'netInTime' });
// operator
Validators.minTime({operator:'>'  ,value:'08:30' });
// value
Validators.minTime({value:'08:00' });
// conditionalExpression
Validators.minTime({conditionalExpression:(x,y) => x.entryPlace == "Main Entry Gate"   ,fieldName:'netInTime' });
// messageKey
Validators.minTime({messageKey:'minTimeMessageKey'  ,value:'08:30' })
// message
Validators.minTime({message:'Please enter valid input greater than config value'  ,value:'07:00' });

maxTime

maxTime validation validator will allow user to enter the input time format which must be less than or equal to the minimum time mentioned in the config parameters. The passing parameter type is MaxTimeConfig.

// allowSeconds
Validators.maxTime({allowSeconds:true  ,value:'02:00:00' });
// fieldName
Validators.maxTime({ fieldName:'netInTime' });
// operator
Validators.maxTime({operator:'>'  ,value:'08:30' });
// value
Validators.maxTime({value:'08:00' });
// conditionalExpression
Validators.maxTime({conditionalExpression:(x,y) => x.entryPlace == "Main Entry Gate"   ,fieldName:'netInTime' });
// messageKey
Validators.maxTime({messageKey:'maxTimeMessageKey'  ,value:'08:30' })
// message
Validators.maxTime({message:'Please enter valid input greater than config value'  ,value:'07:00' });

Numeric

digit

// conditionalExpression
Validators.digit({conditionalExpression:(x,y) => x.age >= 25  });
// messageKey
Validators.digit({messageKey:'digitMessageKey' });
// message
Validators.digit({message:'Please enter only digit.' });

even

even validation validator will check whether the value entered by user is an even number or not. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.even({conditionalExpression:(x,y) => x.type == "Even"  });
// messageKey
Validators.even({messageKey:'evenMessageKey' });
// message
Validators.even({message:'{{0}} is not an even number' });

factor

factor validation validator will allow user to enter valid factor of a number which is called dividend. The passing parameter type is FactorConfig.

// dividend
Validators.factor({dividend:50 });
// fieldName
Validators.factor({fieldName:'firstNumber' });
// conditionalExpression
Validators.factor({fieldName:'firstNumber'  ,conditionalExpression:(x,y) =>x.firstNumber == 25  });
// messageKey
Validators.factor({dividend:50  ,messageKey:'factorMessageKey' });
// message
Validators.factor({dividend:30  ,message:'{{0}} is not a factor of 50' });

latitude

latitude validation validator allows user to enter value which is valid latitude. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.latitude({conditionalExpression:(x,y) => x.continent == "Asia"  });
// messageKey
Validators.latitude({messageKey:'latitudeMessageKey' });
// message
Validators.latitude({message:'{{0}} is not a latitude' });

latLong

latLong validation validator allows user to enter the input which is valid Latitude or longitude. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.latLong({conditionalExpression:(x,y) => x.continent == "Asia"  });
// messageKey
Validators.latLong({messageKey:'latLongMessageKey' });
// message
Validators.latLong({message:'{{0}} is not a proper proper Latitude or Longitude' });

leapYear

leapYear validation validator will check whether the value entered is a leap year or not. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.leapYear({conditionalExpression:(x,y) => x.name == "Bharat"  });
// messageKey
Validators.leapYear({messageKey:'leapYearMessageKey' });
// message
Validators.leapYear({message:'{{0}} is not a leap year' });

longitude

longitude validation validator allows user to enter the input which is in the proper longitude format. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.longitude({conditionalExpression:(x,y) => x.continent == "Asia"  });
// messageKey
Validators.longitude({messageKey:'longitudeMessageKey' });
// message
Validators.longitude({message:'{{0}} is not a longitude' });

maxNumber

maxNumber validation validator will allow user to enter the input upto the maximum number value parameter. The passing parameter type is NumberConfig.

// value
Validators.maxNumber({value:50 });
// conditionalExpression
Validators.maxNumber({value:100  ,conditionalExpression:(x,y) => x.subjectCode == "8CS5A"  });
// messageKey
Validators.maxNumber({value:50  ,messageKey:'maxNumberMessageKey' });
// message
Validators.maxNumber({value:70  ,message:'{{0}} exceeds the Maximum marks Limit' });

minNumber

minNumber validation validator will allow user to enter the input greater than the minimum number value parameter. The passing parameter type is NumberConfig.

// value
Validators.minNumber({value:50 });
// conditionalExpression
Validators.minNumber({value:100  ,conditionalExpression:(x,y) => x.subjectCode == "8CS5A"  });
// messageKey
Validators.minNumber({value:50  ,messageKey:'minNumberMessageKey' });
// message
Validators.minNumber({value:70  ,message:'{{0}} exceeds the Maximum marks Limit' });

numeric

numeric validation validator will check whether the value entered is a valid numberic value or not.The validation can be set according to requirement, it can be either decimal,negative number or positive number. The passing parameter type is BaseValidatorConfig.

// acceptValue
Validators.numeric({acceptValue:NumericValueType.NegativeNumber });
// allowDecimal
Validators.numeric({allowDecimal:true });
// digitsInfo
Validators.numeric({digitsInfo:'1.0-2'  ,allowDecimal:true });
// conditionalExpression
Validators.numeric({acceptValue:NumericValueType.PositiveNumber  ,conditionalExpression:(x,y) => x.dataType == "Integer"  });
// messageKey
Validators.numeric({messageKey:'numericMessageKey' });
// message
Validators.numeric({message:'{{0}} is not a positive number' });

odd

odd validation validator will check whether the value entered is an odd number or not. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.odd({conditionalExpression:(x,y) => x.type == "Odd"  });
// messageKey
Validators.odd({messageKey:'oddMessageKey' });
// message
Validators.odd({message:'{{0}} is not an odd number' });

port

port validation validator allows user to enter the input which is a valid port number. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.port({conditionalExpression:(x,y) => x.browser == "Chrome"  });
// messageKey
Validators.port({messageKey:'portMessageKey' });
// message
Validators.port({message:'{{0}} is not a proper port number' });

primeNumber

primeNumber validation validator allows user to enter only prime number. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.primeNumber({conditionalExpression:(x,y) => x.numberType == "Prime"  });
// messageKey
Validators.primeNumber({messageKey:'primeNumberMessageKey' });
// message
Validators.primeNumber({message:'{{0}} is not a prime number' });

range

range validation validator will check that the entered value is in the specified range. The passing parameter type is RangeConfig.

// minimumNumber  & maximumNumber
Validators.range({minimumNumber:18  ,maximumNumber:60 });
// conditionalExpression
Validators.range({minimumNumber:6  ,maximumNumber:8  ,conditionalExpression:(x,y) => x.age >= 25  });
// messageKey
Validators.range({minimumNumber:1  ,maximumNumber:10  ,messageKey:'rangeMessageKey' });
// message
Validators.range({minimumNumber:1000  ,maximumNumber:200000  ,message:'Your Salary should be between 1000 to 200000.' });

Relational

different

different validation validator will check two inputs whether they are different or not. It is just opposite of different decorator. The passing parameter type is DifferentConfig.

// fieldName
Validators.different({fieldName:'firstName' });
// conditionalExpression
Validators.different({fieldName:'emailAddress' ,conditionalExpression:x => x.userName=="Bharat" });
// messageKey
Validators.different({fieldName:'emailAddress'  ,messageKey:'differentMessageKey' });
// message
Validators.different({fieldName:'firstName'  ,message:'{{0}} is same as firstName' });

lessThan

less than validation validator will allow the user to enter only that value which is less than the value in the pre defined field. The passing parameter type is RelationalOperatorConfig.

// fieldName
Validators.lessThan({fieldName:'obtainedMarks' });
// value
Validators.lessThan({value:60 });
// conditionalExpression
Validators.lessThan({fieldName:'obtainedMarks'  ,conditionalExpression:(x,y) =>  x.obtainedMarks < 35 });
// messageKey
Validators.lessThan({fieldName:'obtainedMarks'  ,messageKey:'lessThanMessageKey' });
// message
Validators.lessThan({fieldName:'obtainedMarks'  ,message:'Please enter number which is less than above field input.' });

lessThanEqualTo

less than equal to validation validator will allow the user to enter only that value which is less than oe equal to the value in the pre defined field. The passing parameter type is RelationalOperatorConfig.

// fieldName
Validators.lessThanEqualTo({fieldName:'totalMarks' });
// value
Validators.lessThanEqualTo({value:60 });
// conditionalExpression
Validators.lessThanEqualTo({fieldName:'totalMarks'  ,conditionalExpression:(x,y) => x.totalMarks == 100  });
// messageKey
Validators.lessThanEqualTo({fieldName:'totalMarks'  ,messageKey:'lessThanEqualToMessageKey' });
// message
Validators.lessThanEqualTo({fieldName:'totalMarks'  ,message:'Please enter number which is less than or equal to above field input.' });

greaterThan

greater than validation validator will check that user's input is greater than related field input. The passing parameter type is RelationalOperatorConfig.

// fieldName
Validators.greaterThan({fieldName:'age' });
// value
Validators.greaterThan({value:18 });
// conditionalExpression
Validators.greaterThan({fieldName:'age'  ,conditionalExpression:(x,y) => x.age > 17  });
// messageKey
Validators.greaterThan({fieldName:'age'  ,messageKey:'greaterThanMessageKey' });
// message
Validators.greaterThan({fieldName:'age'  ,message:'Please enter number which is greater than above field input.' });

greaterThanEqualTo

greater than equal to validation validator will check that input property is greater than or equal to the related field input. The passing parameter type is RelationalOperatorConfig.

// fieldName
Validators.greaterThanEqualTo({fieldName:'admissionAge' });
// value
Validators.greaterThanEqualTo({value:18 });
// conditionalExpression
Validators.greaterThanEqualTo({fieldName:'admissionAge'  ,conditionalExpression:(x,y) => x.admissionAge >= 18  });
// messageKey
Validators.greaterThanEqualTo({fieldName:'admissionAge'  ,messageKey:'greaterThanEqualToMessageKey' });
// message
Validators.greaterThanEqualTo({fieldName:'admissionAge'  ,message:'Please enter number which is greater than or equal to above field input.' });

String

alpha

alpha validation validator will allow only alphabets to be entered. It will not allow any digit or special character. The passing parameter type is AlphaConfig.

// allowWhiteSpace
Validators.alpha({allowWhiteSpace:true });
// conditionalExpression
Validators.alpha({conditionalExpression:(x,y) => x.countryName == "India" });
// messageKey
Validators.alpha({messageKey:'alphaMessageKey' });
// message
Validators.alpha({message:'You can enter only alphabets.' });

alphaNumeric

alphaNumeric validation validator will allow only alphabets and numbers to be entered. It will not allow any special character. The passing parameter type is AlphaConfig.

// allowWhiteSpace
Validators.alphaNumeric({allowWhiteSpace:true });
// conditionalExpression
Validators.alphaNumeric({conditionalExpression:(x,y) => x.areaName == "Delhi"  });
// messageKey
Validators.alphaNumeric({messageKey:'alphaNumericMessageKey' });
// message
Validators.alphaNumeric({message:'Please enter only alphanumerics, special characters are not allowed.' });

ascii

ascii validation validator allows user to enter the input which is in the proper ascii format. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.ascii({conditionalExpression:(x,y) => x.language == "Java"  });
// messageKey
Validators.ascii({messageKey:'asciiMessageKey' });
// message
Validators.ascii({message:'{{0}} is not an Ascii Code' });

contains

contains validation validator will check whether a particular value is in the input. It will not allow user to enter input that does not contains the predefined value. The passing parameter type is DefaultConfig.

// value
Validators.contains({value:'@gmail.com' });
// conditionalExpression
Validators.contains({value:'@gmail.com'  ,conditionalExpression:(x,y) => x.emailAddress == "abc@gmail.com" });
// messageKey
Validators.contains({value:'@gmail.com'  ,messageKey:'containsMessageKey' });
// message
Validators.contains({value:'@gmail.com'  ,message:'Please enter valid gmailId' });

cusip

cusip validation validator will allow user to enter only nine-character alpha-numeric cusip code. CUSIP numbers are used to identify North-American finantial securities. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.cusip({conditionalExpression:(x,y) => x.companyName == "Google"  });
// messageKey
Validators.cusip({messageKey:'cusipMessageKey' });
// message
Validators.cusip({message:'{{0}} is not a valid cusip Code' });

dataUri

dataUri validation validator allows user to enter the input which is a valid data Uri format. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.dataUri({conditionalExpression:(x,y) => x.scheme == "DataUri"  });
// messageKey
Validators.dataUri({messageKey:'dataUriMessageKey' });
// message
Validators.dataUri({message:'{{0}} is not a proper data URI' });

email

email validation validator will only allow user to enter input which is in the correct email format. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.email({conditionalExpression:(x,y) => x.email == "abc@gmail.com"  });
// messageKey
Validators.email({messageKey:'emailMessageKey' });
// message
Validators.email({message:'Please enter valid email' });

endsWith

endsWith validation validator allows user to validate the input which ends with particular value. The passing parameter type is DefaultConfig.

// value
Validators.endsWith({value:'t' });
// conditionalExpression
Validators.endsWith({value:'r'  ,conditionalExpression:(x,y) => x.name == "Bharat"  });
// messageKey
Validators.endsWith({value:'r'  ,messageKey:'endsWithMessageKey' });
// message
Validators.endsWith({value:'b'  ,message:'{{0}} does not ends with `b`' });

extension

extension validation validator allows user to validate the input which is in the proper extension format. The passing parameter type is ExtensionConfig.

// extensions
Validators.extension({extensions:['jpg','bmp'] });
// isExcludeExtensions
Validators.extension({extensions:['jpg','bmp']  ,isExcludeExtensions:true });
// conditionalExpression
Validators.extension({extensions:['doc','docx']  ,conditionalExpression:'(x,y) => x.fileType == "Document"' });
// messageKey
Validators.extension({extensions:['xls','xlsx']  ,messageKey:'extensionMessageKey' });
// message
Validators.extension({extensions:['vcf']  ,message:'You can upload only .vcf files.' });

hexColor

hexColor validation validator will allow user to enter only the input in proper Hex Color format. The passing parameter type is HexColorConfig.

// conditionalExpression
Validators.hexColor({conditionalExpression:(x,y) =>x.color == "#AFAFAF" });
// messageKey
Validators.hexColor({messageKey:'hexColorMessageKey' });
// message
Validators.hexColor({message:'Please enter the right format of hexcode for body like "#AFAFAF"' });

ip

ip validation validator is used to validate the ip address of the device. The passing parameter type is IPConfig.

// isCidr
Validators.ip({version:1  ,isCidr:true });
// version
Validators.ip({version:1 });
// conditionalExpression
Validators.ip({conditionalExpression:'(x,y) => x.ipType == "V6"'  ,version:2 });
// messageKey
Validators.ip({version:2  ,messageKey:'ipMessageKey' });
// message
Validators.ip({version:1  ,message:'Please Enter IP V4 type Only' });

json

json validation validator will allow user to enter the input only in proper Json format. The passing parameter type is JsonConfig.

// conditionalExpression
Validators.json({conditionalExpression:(x,y)=> x.location == "{CountryName:India}"  });
// messageKey
Validators.json({messageKey:'jsonMessageKey' });
// message
Validators.json({message:'Enter the text in JSON format --> {key:value}' });

lowerCase

lowerCase validation validator will allow user to enter only the lowercase alphabets. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.lowerCase({conditionalExpression:(x,y) =>  x.username == "jonathan.feldman"  });
// messageKey
Validators.lowerCase({messageKey:'lowerCaseMessageKey' });
// message
Validators.lowerCase({message:'You can enter only lowerCase letters.' });

mac

mac validation validator will check whether the value entered is a valid mac address. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.mac({conditionalExpression:(x,y) => x.device == "Laptop"  });
// messageKey
Validators.mac({messageKey:'macMessageKey' });
// message
Validators.mac({message:'{{0}} is not a MAC address' });

maxLength

maxLength validation validator will allow user to enter the input upto the maximum length value parameter. The passing parameter type is NumberConfig.

// value
Validators.maxLength({value:16 });
// conditionalExpression
Validators.maxLength({value:16  ,conditionalExpression:(x,y)=> x.firstName == "Bharat" });
// messageKey
Validators.maxLength({value:20  ,messageKey:'maxLengthMessageKey' });
// message
Validators.maxLength({value:10  ,message:'Maximum 10 characters are allowed' });

minLength

minLength validation validator will allow user to enter the input length matching the minimum length value parameter. The passing parameter type is NumberConfig.

// value
Validators.minLength({value:10 });
// conditionalExpression
Validators.minLength({value:3  ,conditionalExpression:(x,y)=> x.countryName == "India" });
// messageKey
Validators.minLength({value:3  ,messageKey:'minLengthMessageKey' });
// message
Validators.minLength({value:8  ,message:'Minimum 8 characters are allowed' });

password

password validation validator will allow user to enter only the input according to correct password validation format. The passing parameter type is PasswordConfig.

// validation
Validators.password({validation:{maxLength: 10,minLength: 5,digit: true,specialCharacter: true} });
// messageKey
Validators.password({validation:{maxLength: 10,minLength: 5,digit: true,specialCharacter: true}  ,messageKey:'passwordMessageKey' });
// message
Validators.password({validation:{maxLength: 10,minLength: 5,digit: true,specialCharacter: true}  ,message:{
                  minLength: 'Minimum Character length should be 5.',
                  maxLength: 'MaxLength allowed is 5'
                } });

startsWith

startsWith validation validator allows user to enter the input which starts with particular value. The passing parameter type is DefaultConfig.

// value
Validators.startsWith({value:'B' });
// conditionalExpression
Validators.startsWith({value:'Senior'  ,conditionalExpression:(x,y) => x.name == "Bharat"  });
// messageKey
Validators.startsWith({value:'A'  ,messageKey:'startsWithMessageKey' });
// message
Validators.startsWith({value:'R'  ,message:'{{0}} does not starts with `R`' });

upperCase

upperCase validation decorator will allow user to enter the alphabets only in the upperCase format. The passing parameter type is BaseValidatorConfig.

// conditionalExpression
Validators.upperCase({conditionalExpression:(x,y) => x.countryName == "INDIA"  });
// messageKey
Validators.upperCase({messageKey:'upperCaseMessageKey' });
// message
Validators.upperCase({message:'You can enter only upperCase letters.' });

url

url validation validator will check that value entered in the property is in the correct url format or not. The passing parameter type is DefaultConfig.

// urlValidationType - FQDN,LocalHost,IntranetServer.
Validators.url({urlValidationType:2 });
// conditionalExpression
Validators.url({conditionalExpression:(x,y) => x.adminWebsiteUrl == "https://google.co.in"  });
// messageKey
Validators.url({messageKey:'urlMessageKey' });
// message
Validators.url({message:'{{0}} Is not the correct url pattern.' });