How to add custom error message in Parsleyjs config file?

1.6k Views Asked by At

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"
});
1

There are 1 best solutions below

1
On

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'
  }
});