We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validator email doesn't work
this will not work: $myForm.hasError('name.email')
$myForm.hasError('name.email')
this will work: $myForm.hasError('name.not_an_email')
$myForm.hasError('name.not_an_email')
See example of this issue with solution
The documentation for the email validator differs from code.
Documentation : email
function email() => { valid: boolean, name : 'email' }; import { field } from 'svelte-forms'; import { email } from 'svelte-forms/validators';
const name = field('name', '', [email()]);
Code :
../node_modules/svelte-forms/validators
export function email() { return (value) => { const regex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/; return { valid: Boolean(value) && regex.test(value), name: 'not_an_email' }; }; }
Since we have different names this validator can not work as explained in documentation.
From my point of view there are two possible solutions:
The text was updated successfully, but these errors were encountered:
Hi,
Thanks for the bug report, it was a wording choice from me, i don't know what i was thinking back then. I'll change this ASAP.
Sorry, something went wrong.
Seems that this behavior is still present in v2.3.1, assume once a new version is up on NPM this validation will be called email.
v2.3.1
email
chainlist
No branches or pull requests
Validator email doesn't work
this will not work:
$myForm.hasError('name.email')
this will work:
$myForm.hasError('name.not_an_email')
See example of this issue with solution
The documentation for the email validator differs from code.
Documentation :
email
Code :
../node_modules/svelte-forms/validators
Since we have different names this validator can not work as explained in documentation.
From my point of view there are two possible solutions:
The text was updated successfully, but these errors were encountered: