Skip to content
Snippets Groups Projects
Commit 71e48348 authored by eduardo morales alberti's avatar eduardo morales alberti Committed by Joseph Olstad
Browse files

Issue #3322946 by Eduardo Morales Alberti, dtarc, himanshu_jhaloya,...

Issue #3322946 by Eduardo Morales Alberti, dtarc, himanshu_jhaloya, joseph.olstad: Once is not well implemented
parent 7e442af0
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,14 @@
(function ($, once) {
// Override clientside validation jquery validation options.
// We do this to display the error markup same as in inline_form_errors.
once('cvjquery', 'document').forEach(element => element.on('cv-jquery-validate-options-update', function (event, options) {
// Using once can not use `window` or `document` directly.
if (!once('cvjquery', 'html').length) {
// Early return avoid changing the indentation
// for the rest of the code.
return;
}
$(document).on('cv-jquery-validate-options-update', function (event, options) {
options.errorElement = 'strong';
options.showErrors = function(errorMap, errorList) {
// First remove all errors.
......@@ -23,5 +30,5 @@
}
});
};
}));
});
})(jQuery, once);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment