question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom error message alongside custom validation

See original GitHub issue

Wasn’t sure whether this was an issue so I post it as a feature.

I’m just getting started with this package and i already like it. For the sake of keeping related things closed, is it possible to keep custom error messages alongside a custom validation method just like required or min or max? And if not I think that would be a nice feature to have. Would reduce the number of type comparison to display the error messages.

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
bluebill1049commented, Oct 10, 2019

Thank you for your kind words! 👍 so glad to hear you like it.

hahaha YES, and it’s documented:

https://react-hook-form.com/api#register

check the checkbox of Register with validation and error message

and scroll down, you should see updated code example and description. I will thin a better way of showing a notification or something in the future

In fact, u probably can reuse those validation rules that you created with the associated message too.

2reactions
bluebill1049commented, Oct 10, 2019

sounds good @jgb-solutions feedback welcome! going to close this issue now 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to return custom error message from controller method ...
I'm talking about a custom message like can be done here... $messages = [ 'required' => 'The :attribute field is required.', ]; $validator...
Read more >
Providing custom error messages for built-in HTML5 form ...
How to customize built-in form validation error messages. Grab the input element(s) with a querySelector / querySelectorAll .
Read more >
Custom Error Messages - express-validator
If you're using a custom validator, then it may very well throw or reject promises to indicate an invalid value. In these cases,...
Read more >
Display Different Error Messages Using Custom Validation!
Requiring specific answers​​ To do this: Select your Address field and find the Custom Error - When option in the field settings. From...
Read more >
Validation - Laravel - The PHP Framework For Web Artisans
Working With Validated Input; Working With Error Messages. Specifying Custom Messages In ... Validating Files; Validating Passwords; Custom Validation Rules.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found