Hello community,
For my scenario, I would like to define new validation rule for phone number input field on checkout page. I would like to limit phone number (e.g. total 11 with + sign). I foundĀ rules under packages/Webkul/Shop/src/Resources/assets/js/app.js. I modified the phone rule from there, but it didn't work. Should I run some command like npm run dev to affect new changes?
Code section in the file
....
/**
* This regular expression allows phone numbers with the following conditions:
* - The phone number can start with an optional "+" sign.
* - After the "+" sign, there should be one or more digits.
*
* This validation is sufficient for global-level phone number validation. If
* someone wants to customize it, they can override this rule.
*/
defineRule("phone", (value) => {
if (! value || ! value.length) {
return true;
}
if (! /^\+?\d+$/.test(value)) {
return false;
}
return true;
});
....