Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Damon 217 posts 288 karma points
    Nov 18, 2015 @ 10:16
    Damon
    0

    How do you programatically populate a field in the back office on publish?

    Hi,

    Is it possible to populate a field in the back office, if the user does not enter data into it?

    Also, is it different when using an archetype data type with repeating fields in it. I have a date field here that I want to populate with todays date if it is left blank.

    Thanks a lot!

  • Kerri Mallinson 113 posts 497 karma points
    Nov 18, 2015 @ 14:18
    Kerri Mallinson
    1

    Hi Damon,

    Do you need to actually populate the field with the current date when an item is created? Is it just to use for output? if so i'd probably just use the built in createDate field if the primary field was left null.

  • Per Olsson 47 posts 307 karma points
    Nov 18, 2015 @ 14:44
    Per Olsson
    0

    Hi Damon,

    If Kerri's solution isn't what you are looking for you can always intercept Save/Publish event and set a another/default value for a property.

    https://our.umbraco.org/documentation/Reference/Events/application-startup

    List of events: https://our.umbraco.org/documentation/reference/events/contentservice-events

Please Sign in or register to post replies

Write your reply to:

Draft