Nested autoforms

Hi

I’m trying to do some nested autoform magic but I’m not sure how to do it right.

I’m using http://autoform.meteor.com/quickform to test the schema out.

Okay, so I’ve tried this, which works:

{
   days: {
      type: Array,
      optional: true,
      minCount: 1,
      maxCount: 4
   },
   "days.$": {
      type: Array,
      label: "Workouts",
      optional: true,
      minCount: 1,
      maxCount: 4
   },
   "days.$.$": {
      type: Number
   }
}

Looks fine, gives me one field inside two nested arrays. But what I want to do is like this:

{
   days: {
      type: Array,
      optional: true,
      minCount: 1,
      maxCount: 4
   },
   "days.$": {
      type: Array,
      label: "Workouts",
      optional: true,
      minCount: 1,
      maxCount: 4
   },
   "days.$.$.workoutType": {
      type: Number
   },
   "days.$.$.sets": {
      type: Number
   },
   "days.$.$.reps": {
      type: Number
   }
}

It doesn’t render anything, and I’m not sure how to solve this. Can someone help me?

Cheers,
Max

not sure if this what you are looking for but it might help.

    {
   day: {
      type: Array,
      optional: true,
      minCount: 1,
      maxCount: 4
   },
   "day.$": {
      type: Object
   },
   "day.$.title": {
      type: String
   },
   "day.$.workout": {
      type: Array,
      optional: true,
      minCount: 1,
      maxCount: 4
   },
   "day.$.workout.$": {
      type: Object
   },
   "day.$.workout.$.workoutType": {
      type: String
   },
   "day.$.workout.$.reps": {
      type: String
   }
}
1 Like

Thank you. This is exactly what I was looking for