我正在使用剑道网格,并希望通过同一记录中的另一个字段验证一个字段的最小值。
意思是我的数据是这样的:-
var courses = [{
CourseID : 1,
CourseName : "iPhone",
MinAge: 12,
MaxAge : 22,
MinAgeThreshold : 10,
MaxAgeThreshold : 30,
StartDate: "12/10/2014",
},
{
CourseID : 2,
CourseName : "Android",
MinAge: 12,
MaxAge : 22,
MinAgeThreshold : 10,
MaxAgeThreshold : 30,
StartDate: "12/10/2014",
}]
我想在 MinAge 的验证最小值中使用 MinAgeThreshold 值,如下所示:-
schema: {
model: {
id: "CourseID",
fields: {
CourseID: { editable: false, nullable: true },
StartDate: { editable: false, nullable: true },
CourseName: { editable: false, nullable: true },
MinAgeThreshold: { editable: false, nullable: true },
MinAge: { type: "number", validation: { required: true, min: MinAgeThreshold} },
MaxAge: { type: "number", validation: { required: true, min: 1} },
}
这有可能吗?
我试图在这样的验证自定义函数中使用
MinAge: {
type: "number",
validation: {
required: true,
minagevalidation: function (input) {
}
},
但我无法在 minagevalidation 函数中检索 MinAgeThreshold 的值。
任何帮助将不胜感激。
问候