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.
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!
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?
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
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
Hi Dave,
Thanks for the suggestion. I'll probably explore other approaches before resorting to this, with it being deprecated.
James
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!
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?
I might need to look at creating a custom property editor. Would prefer a lighter approach if possible though.
is working on a reply...