How do I change the error message “Please fill out this field?”

老子叫甜甜 提交于 2019-12-11 05:08:31

问题


I am having trouble to change this error message. I need the message to be displayed in french.

<input type="text" name="name" id="name" size="30" 
       class="text-input-big" placeholder="PRÉNOM" 
       parsley-type="alphanum" 
       parsley-error-message="Le prénom est requis" required /> 

I used this for my first field, but no matter what I do, or add, still can't see the message that I want to see.


回答1:


Since you are using "alphanum" as type, you could use:

 <input type="text" name="name" id="name" size="30" 
 class="text-input-big" placeholder="PRÉNOM" 
 parsley-type="alphanum" 
 parsley-alphanum-message="Le prénom est requis" required /> 

If you specify the message directly in input, you have to do that for every field (and everytime).

So, the best option is using Localization (see http://parsleyjs.org/doc/index.html#psly-installation-localization). You can download the french localization from here: https://github.com/guillaumepotier/Parsley.js/tree/master/src/i18n. Then you can define your messages in the localization file.



来源:https://stackoverflow.com/questions/20476315/how-do-i-change-the-error-message-please-fill-out-this-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!