18

I have the following input field:

<input id="name" name="real_name" type="text" placeholder="ie. Your full name or company name" class="form-control input-lg parsley-validated"
   data-required="true" parsley-error-message="Please insert your name" >

However, when I press my submit button, I only get the standard This value is required. message.

Can anyone tell me why?

freginold
  • 3,946
  • 3
  • 13
  • 28
Marc Rasmussen
  • 19,771
  • 79
  • 203
  • 364

3 Answers3

60

Try

data-parsley-required-message="Please insert your name"

Ankit Sharma
  • 5,191
  • 2
  • 23
  • 29
27

Try this attribute instead of parsley-error-message:

data-parsley-required-message="Please insert your name"

It's not a custom error message for custom validator. You need to override the default 'required' error message with your one.

zhulien
  • 5,145
  • 3
  • 22
  • 36
vitkon
  • 1,058
  • 8
  • 13
  • could you look at my Ajax question aswell? http://stackoverflow.com/questions/21391978/parsley-ajax-sending-post-variables – Marc Rasmussen Jan 28 '14 at 13:08
  • is `data-parsley-error-message="my message"` only for custom validation ? The documentation says: `Customize a unique global message for the field.` I toought it was working like @MarcRasmussen said. (i have a local and remote validation for VAT validation and the error message is the same) – Leto Jan 06 '15 at 14:05
  • 3
    @Leto: I tried `data-parsley-error-message` and it works for all error messages for that field. It just becomes the error message for *any* error in that field. – nils Oct 07 '15 at 06:44
  • doesn't work for me i using `bootstrap 4` and `parsley 2.9.1` – sanoj lawrence Jul 17 '19 at 04:00
  • 1
    For more recent versions: `data-parsley-required-message` – John Jul 31 '20 at 21:20
  • I have required and a custom validation for a field but it is taking data-parsley-error-message for both this didn't help me – gangothri Sep 04 '20 at 07:33
1

For required field validation :

data-parsley-required-message="Please enter name"

For input pattern validation :

data-parsley-pattern-message="Please enter valid name"

In short change third word with your validation type.