Replies: 1 comment 1 reply
-
|
This would be a great idea, but all FormKit validation rules and code need to be fully isomorphic so they can be run both on the server and in the browser — so we cannot rely on browser APIs where DOM nodes are strictly available. You can of course add your own email validation to the dom elements for browser validation if you prefer that one. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've noticed that the email validation rule is being handled via a RegExp:
https://github.com/formkit/formkit/blob/master/packages/rules/src/email.ts
But all browsers have a build-in email validator for input[type=email] tags, and IMHO everything that can be done natively by the browser, should be done by the browser;
So, I'm suggesting replacing this direct validation with something like:
Besides avoiding reinventing the wheel, this approach is also much clearer and more readable in my opinion. 🙂
Beta Was this translation helpful? Give feedback.
All reactions