1

I have built a few fields with the Table field. I noticed an odd behavior maybe it's normal, but want to check.

I use a Table field with defaults entered, the defaults do not show up. Now for the odd, if I put the Table field in a Matrix field, the defaults show up. Is that normal Table field behavior?

1

I just did some testing of this. I thought I noticed the same thing, but then realised that I created and added the field to my section (a single) only after it already existed. In that case the defaults didn't show. But then I added the field to a channel section and created a new entry and the defaults show in that case.

So I think the reasoning is that it won't populate defaults on an already existing entry as these could easily go unnoticed by someone editing and end up being saved to the entry when unintended.

| improve this answer | |
  • Interesting find Mike! Thanks for doing that :) Yes indeed that makes sense and the only thing I did not test was a new entry. So the odd part than I guess is that Matrix with a Table field works as expected. Good to know. – Vin Apr 27 '17 at 15:35
  • 1
    Well, you can think of a new matrix block as a type of new "entry" anyway (programatically in Craft, they are just another type of element), so I think it follows the logic I've laid out. – Mike Pierce Apr 27 '17 at 15:37
  • Makes perfect sense. – Vin Apr 27 '17 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.