1
之情況:我已經添加了驗證,以觀察到的陣列,例如是關於一個可觀察的領域中觀察到的陣列 如:沒有得到errorElementClass
this.field = ko.observable().extend({
required: { params: true, message: "field is required." },
digit: { params: true, message: "field must be number." },
min: { params: 0, message: "field must be between 0 to 9999." },
max: { params: 9999, message: "field must be between 0 to 9999." }
});
而且初始化驗證:
ko.validation.init({
registerExtenders: true,
messagesOnModified: false,
insertMessages: false,
decorateElement: true,
errorElementClass: 'input-validation-error',
errorMessageClass: 'field-validation-error'
});
但不獲得errorElementClass: 'input-validation-error'
,用於除需要驗證之外的其他驗證注意:對於其他驗證規則違規,它取class = valid,但會顯示錯誤消息'