Does anybody know how to solve this problem:
i'm trying to add custom field validation. Chrome console does not have any errors.
app/code/Company/Module/view/frontend/web/js/view/payment/script.js
define(
[
"jquery",
"mage/validation"
],
function ($) {
console.log('fire1');
$.validator.addMethod('test-req', function(v) {
console.log('fire2');
return false;
}, 'The amount you entered is too low.');
}
);
src/app/code/Company/Module/view/frontend/web/template/payment/form_additional.html
<input class='required test-req' type='text' data-bind="value: checker" placeholder='Enter the value' minlength='10' maxlength='10'/>
On page loading fire1 always works. But fire2 is never called. What could be a problem here?