I have a mixin which is extending functionality for validation purpose. See the code below
define([
'jquery',
'Magento_Ui/js/lib/validation/validator'
], function ($, validatorlib) {
"use strict";
console.log('test');
return function () {
console.log('test123'); // this is coming in console
var regex_pattern = window.address_field_pattern;
if (regex_pattern == '')
return true;
validatorlib.addRule(
'validate-gearalphanumeric',
function (value) {
if (value)
return regex_pattern.test(value);
else
return true;
},
$.mage.__('Please use only numbers and Latin characters in this field.')
);
$.validator.addMethod(
'validate-gearalphanumeric',
function (value) {
if (value)
return regex_pattern.test(value);
else
return true;
},
$.mage.__('Please use only numbers and Latin characters in this field.')
);
}
});
NOTE : It was working in 2.2 version
and I do have verified the implementation as well but it seems not working.
Anyone find any issue in above do let me know.