Custom error messages as data attribute
See original GitHub issueHi there,
It would be really nice if you could add a custom error message as a data attribute to a field.
I would assume that data-bouncer-message
would do the trick but it only works when a pattern fails, as you can see from this fiddle:
https://jsfiddle.net/rsx83ouw/5/
Other than that, a great library!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Using Data Attributes for Custom Validation Messages in HTML5
We can use field DATA attributes to customize our error messages and show a different one in each error case. Data attributes are...
Read more >How to use custom attribute parameter in error message in ...
Hi,. I am writing custom validation attribute and it has parameter. Now I want to use that in error message but I am...
Read more >jquery validate custom error element with data message attribute
I solved this problem by first checking if the error div already exists: errorPlacement: function (error, element) { error ...
Read more >Form required attribute with a custom validation message in ...
We first use the checkValidity() method to check if the input fields contain valid data and run checkValidity() on form submit in order...
Read more >How to create custom error rule using request attribute value ...
We have 200 error codes captured in a request attribute. In which some are considered Technical errors and some are businesses errors. We...
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 FreeTop 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
Top GitHub Comments
I just deployed this on a project and [data-bouncer-message] worked on all fields. Trying it on another and it doesn’t work. The one that worked was using the CDN and loading v1.0.5. The non-working project I used downloaded v1.4.6. My conclusion is that it worked on all fields as a data attribute originally, and has since been changed.
You can create your own custom attributes, see the demo in the docs: https://codepen.io/cferdinandi/pen/ywMdKp
Specifically, line 22 of the demo JS:
You can create any
data-attr
format/naming convention and values you wanted.Another example: