validation - multiple knockout validators on an observablearray -


i tried define multiple custom validation rules under observable array, referring https://github.com/ericmbarnard/knockout-validation/wiki/custom-validation-rules.

following observablearray validation calls:

    this.weeklydata = ko.observablearray([]).extend({     validation: [         {             validator : fminincrements,             message: 'use 15 min increments'         },         {             validator: validateminmax,             message: "invalid min/max value"         }     ]     });  var validateminmax = function (valuearray) { var check = true; ko.utils.arrayfirst(valuearray, function (value) {     if (parseint(value.val(), 10) < 0 || parseint(value.val(), 10) > 168) {         check = false;         return true;     } }); return check; };  var fminincrements = function (valuearray) { var check = true; ko.utils.arrayfirst(valuearray, function (value) {     if (parseint(value.val(), 10) % 15 !== 0) {         check = false;         return true;     } }); return check; }; 

when first rule fires. debugged, , doesn't hit second one. idea?

thanks in advance help.

i believe because using ko.utils.arrayfirst(). if use ko.utils.arrayforeach() instead check every case shouldn't return @ first occurrence.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -