[Question]: Is there a way to add validation messages with custom validators?
See original GitHub issueAdding I18n messages with existing validators is possible but can it be done with a custom validator?
const sizeValidator = (size: number = 15) => (value: string) => {
return !helpers.req(value) || value.length === size
}
export const size = withI18nMessage(sizeValidator)
Something like the above.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to Add Custom Validation Error Message for ...
I'm using reactive angular forms and created new custom form validator but its not showing custom messages I wanted to add custom message...
Read more >Custom Validators
You can easily write custom validators and combine them with builtin ones, as those are just a simple predicate functions.
Read more >How To Use Custom Form Validation in Angular
Learn how to create a custom validator in Angular for both template-driven and reactive forms.
Read more >Angular Custom Form Validators: Complete Guide
A validator can be plugged in directly into a reactive form simply by adding it to the validators list. Each form field has...
Read more >Response Requirements & Validation
There are two types of custom validation messages you can create: modified Qualtrics error messages, where you take a system default message and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It did not, I did manage to get it working with something like the below though. (for future reference for anyone)
You probably dont need to specify
$message
if you are applying i18n messages. But yeah, glad you sorted it out. Docs could deff be improved in this regard.