Simple-schema conditionally required field within array of objects

165 Views Asked by At

I'm trying to make a field conditionally required, however, I'm having trouble accessing the field value when it's within an array of objects. this.field returns undefined. Basically what I want to do is check if the classes.$.active field is false. If it is false I want the monday field to set to false. If I can successfully check the value of active I can do the rest.

classes: {
  type: Array,
  optional: true,
},
'classes.$': {
  type: Object,
  optional: true,
},
'classes.$.monday': {
  type: Boolean,
  optional: true,
  custom() {
    console.log('test', this.field('classes.$.active').value);
  },
}
0

There are 0 best solutions below