Magento Asked on January 16, 2021
I wish to add custom validation message in my account information section
Please provide me a solution to add custom message in below template.
vendor/magento/module-customer/view/frontend/templates/form/edit.phtml
You can add this data-msg-required="Please add confirm password."
for custom validation password and for Validation you can try this.
create requirejs-config.js
in your module with this code.
var config = {
config: {
mixins: {
'mage/validation': {
'Vendor_Module/js/validation-mixin': true
}
}
}
}
Now add create validation-mixin.js
file at Vendor_Module/view/frontend/web/js/validation-mixin.js
with this code.
define([
'jquery'
], function ($) {
"use strict";
return function () {
$.validator.addMethod(
'validate-minimum-age',
function (value) {
// Some custom validation stuff here
return true or false;
},
$.mage.__('Your validation error message')
);
}
});
We can use same way for checkout.
Answered by kunj on January 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP