Skip to content
Snippets Groups Projects
Commit 5247d6c1 authored by Dave Tarc's avatar Dave Tarc Committed by Joseph Olstad
Browse files

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

Issue #3322946 by Eduardo Morales Alberti, dtarc, himanshu_jhaloya, hchonov: Once is not well implemented
parent c8bd7a2d
Branches
Tags 8.x-1.12
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