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?

0

1 Answer 1

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.

3
  • 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
    Commented Apr 27, 2017 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. Commented Apr 27, 2017 at 15:37
  • Makes perfect sense.
    – Vin
    Commented Apr 27, 2017 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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