Copied to clipboard

Flag this post as spam?

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


  • James Strugnell 84 posts 192 karma points
    Mar 10, 2017 @ 17:26
    James Strugnell
    0

    Dynamically pre-fill page fields on first load

    Hi,

    Is there a way to dynamically pre-fill a page field on first load? By that I don't mean when the user first hit's Save/Publish. I mean when a page's properties first appear on the screen, is there a recommended way of dynamically setting a field's value?

    We have the situation where nodes are created in a sequence and a few of the values in each node are generally going to be the same as they were for the previously created node. However, they may have changed so we would like to initially set them to be the same as the previous item, then allowing the editor to change them if necessary.

    Is there a "right" way of doing this?

    Thanks James

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Mar 11, 2017 @ 07:36
    Dave Woestenborghs
    0

    Hi James,

    You can hook into to the Created event of the ContentService. But be aware, these are marked obsolete according to the documentation : https://our.umbraco.org/documentation/Reference/Events/ContentService-Events

    Dave

  • James Strugnell 84 posts 192 karma points
    Mar 13, 2017 @ 13:02
    James Strugnell
    0

    Hi Dave,

    Thanks for the suggestion. I'll probably explore other approaches before resorting to this, with it being deprecated.

    James

  • Micha Somers 134 posts 597 karma points
    Mar 11, 2017 @ 11:13
    Micha Somers
    0

    Besides Dave's solution, for default values, there is also a ContentTemplates backoffice extension available.

    Although I have not used it myself yet, it might be worth a try in case you can save the new default values to the content template node before creating the other new node(s), especially when that can be done using a non-obsolete event like Saving or Saved .

    Anyways, please let us know if you have found a reasonable way to solve it!

  • James Strugnell 84 posts 192 karma points
    Mar 13, 2017 @ 13:04
    James Strugnell
    0

    Thanks Micha. This looks like it might provide a solution but I can't see any documentation on how it actually works?

    Do you know if it is possible to inject a bit of JavaScript on the "New node" form so that we could then query back into the API and pull out the previous values?

  • James Strugnell 84 posts 192 karma points
    Mar 13, 2017 @ 13:13
    James Strugnell
    0

    I might need to look at creating a custom property editor. Would prefer a lighter approach if possible though.

Please Sign in or register to post replies

Write your reply to:

Draft