knockout.js - Knockout validation message based set in the validation function -
i want set message display in validation function of knockout similar whats going on here: knockout validation plugin custom error message without async.
heres ive tried, no validation message displayed.
this.name = ko.observable().extend({ validation: { validator: function (val) { return { isvalid:val === 'a', message: 'the value ' + val + ' not a' }; }, message: 'i dont want default message' } });
is there way this?
close, validator should returning true/false if rule passed. couldn't message:
display value (even setting function had undefined
arguments) can inline error message if want display value user.
this.name = ko.observable().extend({ validation: { validator: function (val) { if (val !== 'a') { this.message = 'the value ' + val + ' not a'; return false; } return true; } } });
Comments
Post a Comment