0

I would like to add a custom error message to my Parsley Config file but don't know how to.

I wonder if it's possible to do something like as per below? :

<input name="name" value="" type="text" required data-parsley-custom>

window.ParsleyConfig.i18n.se = $.extend(window.ParsleyConfig.i18n.se || {}, {
   custom: "Custom error message"
});
worldofjr
  • 3,868
  • 8
  • 37
  • 49

1 Answers1

1

Is there an issue with using the example from the doc?

window.Parsley
  .addValidator('multipleOf', {
    requirementType: 'integer',
    validateNumber: function(value, requirement) {
    return 0 === value % requirement;
  },
  messages: {
    en: 'This value should be a multiple of %s',
    fr: 'Cette valeur doit être un multiple de %s'
  }
});
worldofjr
  • 3,868
  • 8
  • 37
  • 49
Marc-André Lafortune
  • 78,216
  • 16
  • 166
  • 166
  • The doc is OK but i think it would be nice if custom validators have a separate message file i18n/en.js or can add custom messages into existing i18n file – Martinez May 09 '20 at 04:51