Parsley custom error message doesn't work

2019-04-04 17:50发布

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?

3条回答
乱世女痞
2楼-- · 2019-04-04 18:15

Try this attribute instead of 'parsley-error-message':

data-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.

查看更多
Viruses.
3楼-- · 2019-04-04 18:18

Try the following:

data-parsley-required-message="MESSAGE"
查看更多
萌系小妹纸
4楼-- · 2019-04-04 18:23

Try

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

查看更多
登录 后发表回答