Skip to content

Commit 63c592a

Browse files
authored
Add support for validation message callback
- Adds a type check for message just before attempting to process validation params on it - Resolves the callback if it was one using the validation rule for the 'this' context
1 parent 523a83e commit 63c592a

File tree

1 file changed

+4
-0
lines changed
  • app/code/Magento/Ui/view/base/web/js/lib/validation

1 file changed

+4
-0
lines changed

app/code/Magento/Ui/view/base/web/js/lib/validation/validator.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ define([
4848
params :
4949
[params];
5050

51+
if (typeof message === 'function') {
52+
message = message.call(rule);
53+
}
54+
5155
message = params.reduce(function (msg, param, idx) {
5256
return msg.replace(new RegExp('\\{' + idx + '\\}', 'g'), param);
5357
}, message);

0 commit comments

Comments
 (0)