I'm using vuelidate on a form and have two inputs "First Name" and "Last Name" then in another section of the form is another input that combines the two "first name last name" and the must match which is working fine and validates.
What I would like is for the case sensitivity to not matter. so as long as the strings are equal the casing does not matter and still will match and validate. Is there a way to incorporate a regular expression? or possible convert all to lowercase?
firstName: {
required,
},
lastName: {
required,
},
signature: {
required,
validSignature: (value, vm) => {
const trimmedInput = value.trim().replace(/s+/g, ' ')
const first = vm.firstName
const last = vm.lastName
if (trimmedInput.toLowerCase() === 'signature on file') {
return true
}
if (first == null || last == null) return false
const expectedValue = first.concat(' ', last)
return trimmedInput === expectedValue
},
},
question from:
https://stackoverflow.com/questions/65924058/vuelidate-match-sameas-but-ignore-case-sensitivity 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…