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.

Add support for custom validation messages

See original GitHub issue

The component currently has a set of predefined validation error messages inside resources object in validators.js. It would be very nice to be able to specify custom validation messages other than those that are predefined. Example:

 required:true,
 min:6,
 validator: VueFormGenerator.validators.string,
 validatorMessage: "Password must be at least {1} characters",

This would basically replace the predefined message textTooSmall and would display the specified validatorMessage.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cristijoracommented, Feb 12, 2017

I see your point. Maybe have the possibility to specify the validators as an array of objects

validator:[{validator:VueFormGenerator.validators.string,message:"Password must be at least {1} characters"}]

Since you iterate through each validator in the array, you can verify if it’s an object and if it has a custom message, then you can pass the custom message to the validator function. Don’t know if it’s worth it though after looking through the code.

0reactions
icebobcommented, Mar 23, 2017

I implemented it in #169

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a custom validation error message that contains ...
On the Home tab, click Add Rule, click Is Not Between, and then click Show Validation Error. In the ScreenTip text box of...
Read more >
How to Add Custom Validation Messages?
To add a custom validation message to a field go to Form > Edit Field > Advanced > Custom Validation Message. Updated on...
Read more >
Custom Validation MessageSource in Spring Boot - Baeldung
Learn how to register a custom MessageSource for validation messages in Spring Boot.
Read more >
Custom Validation Messages | QuestionPro Help Document
To add a new validation message Go to: Login » Surveys (Select Survey) » Edit. Click on the Validation icon on the question....
Read more >
HTML5 form required attribute. Set custom validation message?
In my case I want to check that the value is a number before posting but I can't use the type="number" attribute (for...
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