You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the correct way to allow an empty string ('') to validate? I haven't marked this field as optional, but I set min to 0. I'd expect it to reject my insert if I passed null, undefined, or omitted the field entirely, but it seems to also reject an empty string. Is this by design? For certain applications, might it make sense to allow empty string as an acceptable value? I'm willing to try to work around this, but wanted to be sure it's a design decision that I can learn, and not a bug. Thanks!
The text was updated successfully, but these errors were encountered:
Yes, an empty string fails required validation by design. If there are enough complaints, this could be changed, but I think it generally makes sense. To make it allow an empty string but not null or undefined, you could use optional: true along with a custom function similar to this:
What is the correct way to allow an empty string ('') to validate? I haven't marked this field as optional, but I set min to 0. I'd expect it to reject my insert if I passed null, undefined, or omitted the field entirely, but it seems to also reject an empty string. Is this by design? For certain applications, might it make sense to allow empty string as an acceptable value? I'm willing to try to work around this, but wanted to be sure it's a design decision that I can learn, and not a bug. Thanks!
The text was updated successfully, but these errors were encountered: