Saskia Bobinska
Support Engineer @Sanity
Saskia is located at Berlin Germany
An Email field, that uses Regex-Validation.
{
name: 'email',
title: 'Email',
type: 'string',
validation: Rule => Rule.custom(email => {
if (typeof email === 'undefined') {
return true // Allow undefined values
}
return email.toLowerCase()
.match(
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
)
? true
: 'This is not an email'
})
}
Support Engineer @Sanity
Validation of url input to allow certain URI schemes (mailto, tel and more included)
Go to Validation of url input to allow certain URI schemesSometimes you want to validate items in an array, here is how
Go to Validation of Array Items