How to set multiple error messages?
See original GitHub issueAn input box has multiple validation rules, such as required and email, so how can I distinguish between setting prompt characters for them?
<input type="text" class="form-control" v-model="form.email" v-validate.disable="'required|email'" data-vv-as="email address" name="email" placeholder="enter email">
I hope that the error prompt of required is “mailbox must be filled”, and the email is “the mailbox format you entered is not correct”.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
How to add multiple error messages inside a custom request?
Inside my custom request, I have a custom rule and it runs multiple conditions. How can I add error messages to each of...
Read more >How to fix multiple error messages shown in a single line issue
1. Write an activity and call Page-Set-Messages method. Then reference Message rule by RUF. · 2. Here are the two Message rules that...
Read more >How do I account for multiple error messages with a single Try ...
You can check for multiple errors using the following method: try: ... except (NameError, TypeError) as error: print(error).
Read more >React Hook Form - ErrorMessage: multiple error messages
TemplateReact Hook Form - ErrorMessage · Environmentcreate-react-app.
Read more >Error Messages: Examples, Best Practices & Common Mistakes
How to write good error messages: The 4 H's · 1. Write for humans (be understandable) · 2. Make sure the message is...
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

yes, it does. Thank you very much.But there is also a situation where I have an email input box on multiple pages, and in this way the value of the “name” attribute in my input box has to be different, otherwise the error message will not be correct
If I have 10 pages with email input fields, and they all have their own validation rules and corresponding error messages, then I’m not going to define 10 names.So what I’m trying to say is can you define error messages in the page, not in mian.js, because in mian.js the definition can affect the whole world
Sorry, was away for a few days.
Thanks for the suggestions and the proposals, I believe this was requested before and I was against it since I don’t like adding too many attrs to the template, it can get ugly really quick.
Instead, use the
customfield in the dictionary to set your custom messages, which is very similar to the jquery validator.Note that it matches the custom field with the name of the field, meaning your field must have the name
emailin the previous snippet.Here is an example of it:
https://codesandbox.io/s/rlvk13ln7n