【问题标题】:How do I change the error message "Please fill out this field?"如何更改错误消息“请填写此字段?”
【发布时间】:2013-12-09 17:03:57
【问题描述】:

我无法更改此错误消息。我需要以法语显示消息。

<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 /> 

我将它用于我的第一个字段,但无论我做什么,或添加,仍然无法看到我想看到的消息。

【问题讨论】:

    标签: parsley.js


    【解决方案1】:

    由于您使用“alphanum”作为类型,您可以使用:

     <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 /> 
    

    如果您直接在输入中指定消息,则必须为每个字段(并且每次)都这样做。

    因此,最好的选择是使用本地化(请参阅http://parsleyjs.org/doc/index.html#psly-installation-localization)。 您可以从这里下载法语本地化:https://github.com/guillaumepotier/Parsley.js/tree/master/src/i18n。然后您可以在本地化文件中定义您的消息。

    【讨论】:

      猜你喜欢
      • 2015-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-04
      • 1970-01-01
      • 1970-01-01
      • 2021-10-24
      相关资源
      最近更新 更多