Wet-boew: Forms Validation - Is it possible to customize the error messages?

Created on 11 Feb 2020  路  6Comments  路  Source: wet-boew/wet-boew

I would like to change the default sentence "The form could not be submitted because X errors were found." to something else. Is that even possible?

Thank you,

Form Validation Question Ready for implementation

Most helpful comment

Maybe so. You should follow https://github.com/wet-boew/wet-boew/issues/8803.

Edit: Using the discussion in #8803 and the lang-code column from https://github.com/wet-boew/wet-boew/blob/master/src/i18n/i18n.csv, I think that these are the two fields you want to try to overwrite:

  • wb.i18nDict["frm-nosubmit"]
  • wb.i18nDict["errs-fnd"]

All 6 comments

Maybe so. You should follow https://github.com/wet-boew/wet-boew/issues/8803.

Edit: Using the discussion in #8803 and the lang-code column from https://github.com/wet-boew/wet-boew/blob/master/src/i18n/i18n.csv, I think that these are the two fields you want to try to overwrite:

  • wb.i18nDict["frm-nosubmit"]
  • wb.i18nDict["errs-fnd"]

HEY, I need your help. I update the change as suggested. it shows the customized error message on IE, HOWEVER. NOT in chrome and edge. why?

@RobJohnston

Could you post some code @mingjiongliao, to show what works in IE but not elsewhere?

basically I just copy the code posted here:

$(".wb-frmvld").one("timerpoke.wb", function (event) {
         if (document.getElementsByTagName("html")[0].getAttribute("lang") !== "en")
                return;
            wb.i18nDict["frm-nosubmit"] = "Please correct ";
            wb.i18nDict["errs-fnd"] = " errors on this page.";
            wb.i18nDict["err-fnd"] = " error on this page.";
        });
$(".wb-frmvld").one("timerpoke.wb", function (event) {
     if (document.getElementsByTagName("html")[0].getAttribute("lang") !== "fr")
            return;

        wb.i18nDict["frm-nosubmit"] = "Veuillez corriger ";
        wb.i18nDict["errs-fnd"] = " erreurs sur cette page.";
        wb.i18nDict["err-fnd"] = " erreur sur cette page.";
    });

it works in local and when I deploy to server, I can see the customized error message in IE, but not in Chrome and Edge.

It all looks good to me... don't know why it would work in one browser but not others. I put together a fiddle in case anybody else wants to see this working*: https://jsfiddle.net/wh4a5q3x/

*And because I think we should use more fiddles!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juleskuehn picture juleskuehn  路  3Comments

matty-tee picture matty-tee  路  4Comments

shawnthompson picture shawnthompson  路  4Comments

jkshapiro picture jkshapiro  路  6Comments

EricDunsworth picture EricDunsworth  路  6Comments