Default value for hidden fields in blueprint

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, :frowning:

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 can help you.

Look at “created …”

Good luck.

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