-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
The section below seems a bit odd to me as. If I have optional email field for users validated with 'email' rule, they can submit null and '' as values and it passes. However if they provide ' ' (single space) it fails as an invalid email. This seems like a bit of a hole for all rules (except 'accepted', 'exists', and 'required'). If I don't want to require an email, but want it validated if present, I would NOT expect '' or null to pass validation. Null and '' ARE values to be validated against. Thoughts?
// If the rule isn't an existence / required check, return
// true if the value doesn't exist.
if (rule !== 'accepted' && rule !== 'exists' && rule !== 'required') {
if (value === '' || value == null) return;
}
Metadata
Metadata
Assignees
Labels
No labels