Is it possible to store creation date (and creation user) in a hidden field when I create a new page?
This ist my blueprint example. creation_date stays always empty,
creation_date:
label: creation_date
type: hidden
default: (date: d.m.Y, H:i:s)
You could do it with hooks…
And update()
I dont think you acutally need a field for the creation date. I think you can read it directly from the file. You can certinaly get the modified date…
May be the first article at https://forum.getkirby.com/t/howto-automatic-update-of-the-last-updated-field-in-the-panel/16758 can help you.
Look at “created …”
Good luck.
@texnixe:
Feel free to make a cookbook article from the linked HowTo.
This should be possible, but not with the syntax you are using. For a users field, you can require it and don’t need an extra setting. The date field you can set to now
.
You don’t need hooks for this. But please keep in mind that default values only work at page creation.
I’m not so sure the hidden field is the right choice for this. Why not use the proper field types but disable them so they cannot be changed by the user. With the correct field types you make sure that the date is stored in the right format and defaults work properly.
1 Like