Hello, I need to set min property on a field, but it depends on another field value, the problem is, in the min() function ‘this’ is very limited, so can not say:
new SimpleSchema({
otherField:{
type: Number,
},
field:{
type: Number,
min() {
/*this doesn’t work (this can not accces to siblings fields values here ) */
let minConstraint = this.field(‘otherField’).value ;
return minConstraint;
}
}
})
Instead I need to do it on custom function, but I don’t know how to return min constraint from there, what I’m trying to do is this:
new SimpleSchema({
otherField:{
type: Number,
},
field:{
type: Number,
custom(){
let minConstraint = this.field(‘otherField’).value;
//Return constraint here
return SimpleSchema.Constarint.min = minConstarint;
//Something like that
}
}
})
How can I achieve that,I’ll appreciate any help you can give me