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 for field of type 'email' not working

See original GitHub issue

Hi,

I’m currently integrating Parsley for a site, and am having a problem setting a custom error message for an email field. I also have a ‘required’ constraint on this field, with an accompanying error message, and that works, but when the email address is not valid I’m seeing the default “This value should be a valid email.” error message rather than the one I’ve set. My field looks like this:

<input class="form-control" data-parsley-required data-parsley-type="email" data-parsley-required-message="email address required" data-parsley-email-message="must be a valid email address" name="email" type="text" id="email">

Many thanks -

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
guillaumepotiercommented, May 16, 2014

Try using data-parsley-type-message="must be a valid email address" instead please.

5reactions
martin-gcommented, Mar 10, 2015

I’ve been tripped by this too. The documentation at http://parsleyjs.org/doc/index.html#ui-for-field

Validator error message #2.0 data-parsley-constraint-message=“my message” Customize the error message for the field constraint. eg: data-parsley-required-message=“this field is required”

is a bit confusing here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML5 form required attribute. Set custom validation message?
Here is the code to handle custom error message in HTML5: <input type="text" id="username" required placeholder="Enter Name" oninvalid="this.
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 . · Add an event ......
Read more >
How To Create A Custom Email Validation Error Message
Want to know how to create custom email validation error messages? We provide an outline with code snippets that you can use as...
Read more >
Client-side form validation - Learn web development | MDN
A field is invalid if it has a value and that value has fewer characters than the minlength value or more than the...
Read more >
Showing custom validation error in HTML5 - Tech Funda
As we all know that there is no uniformity in the form element validation messages comes in different browsers. To make these error...
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