- Notifications
You must be signed in to change notification settings - Fork26.4k
feat(forms): switch to RegExp in pattern validator#62671
New issue
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:prototype/signal-forms
Are you sure you want to change the base?
feat(forms): switch to RegExp in pattern validator#62671
Conversation
No other libraries use string patterns for validation
metadata(path, PATTERN, (ctx) => { | ||
const result = reactivePatternValue(ctx); | ||
if (result === undefined) { | ||
return []; | ||
} | ||
return [result]; | ||
return [result.source]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
shouldn't we switch thePATTERN
metadata to be an array ofRegExp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
How is thePATTERN
metadata intended to be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It is just to give the user some way to get the list of patterns that are being applied to the field. They could use it to set the pattern attribute if they want, or to show a "hint" message under the input like "your username must be formatted like: ...".
Most users probably don't care too much about it, but for things likerequired
andmin
, the metadata is very important because it can be used to show the required*
or set themin
attribute on the input. For consistency we give you the pattern as metadata too
Uh oh!
There was an error while loading.Please reload this page.
No description provided.