knockout.js - Knockout Validtion - Hide error messages -


i never want error messages appear on view (i using toastr display errors generated knockout validation). in code, using: insertmessages: false. suppresses errors unless user enters data in required field, removes data, , tabs out of control. can't figure out how hide error messages when user tabs out of input control. here code excerpts-

viewmodel-

 lcamount: ko.observable(lcamount).extend({ insertmessages: false, required: { message: 'lc amount required' } })          var saveall = function () {         try {              var goahead = true;             var changes = false;              saveflag(true);                ko.utils.arrayforeach(loandetails(), function (item) {                   if (item.lcamount != '')                      changes = true;                   if (item.errors().length > 0) {                     goahead = false;                     logerror("errors on form: " + item.errors(), item, true);                 }              });                   if (goahead && changes && okstosave) {                 $.prompt("are sure want save? not able change decision after it's been saved.", {                     title: "save?",                     buttons: { "save": true, "cancel": false },                     submit: function (e, v, m, f) {                         if (v) {                             response = saveupdates(loandetails);                              });                              vm.clientnumber('');                             vm.clientname('');                         }                     }                 });             } 

view-

  <input data-bind="value: lcamount, validationoptions: { insertmessages: false }" /> 

try wrapping input in container div , apply validationoptions that.

<div data-bind="validationoptions: { insertmessages: false }"><input data-bind="value: lcamount" /></div> 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -