Copied to clipboard

Flag this post as spam?

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


  • Dan Christoffersen 64 posts 119 karma points
    Aug 12, 2009 @ 15:57
    Dan Christoffersen
    0

    Any way to change the default value of a property?

    How can set the default value of property on a document type. F.ex. setting the umbracoNaviHide to true by default???

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 12, 2009 @ 16:02
    Dirk De Grave
    0

    You can't actually, unless you modify the core code. It would be great tho to have such functionality...

     

    Cheers,

    /Dirk

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 12, 2009 @ 16:03
    Dirk De Grave
    2

    You could however use event handlers to listen for new events on documents, check current document (and document type) and set some default values.

  • Chris Koiak 700 posts 2626 karma points
    Aug 12, 2009 @ 16:14
    Chris Koiak
    0

    Dirk's right, in this situation I usually end up hard coding defaults into my xslt files and do the checking there.

    I thought you could create datatypes that subclass the current ones (textbox, dropdown, etc) but that check a config file for default values on new page creation. Would make a good package...

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Aug 12, 2009 @ 16:16
    Douglas Robar
    0

    Dirk, can you add the 'default value of docType properties' idea to codeplex? Just like the description or validation it may not be used often, but would be a huge benefit to have! (guess I've been using umbraco so long I don't even notice these things any more)

    cheers,
    doug.

  • Dan Christoffersen 64 posts 119 karma points
    Aug 12, 2009 @ 16:31
    Dan Christoffersen
    0

    Thanks for the quick replies. Looking forward to see it in a future release ;-)

    /Dan

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 12, 2009 @ 16:34
    Peter Dijksterhuis
    2

    Dan,

    you could change the way umbracoNaviHide works easy. Instead of saying: 'Hide in navigation', name it 'Show in navigation' which causes the default to be false. This offcourse means a slight modification to your xslt's where you have to change the != into =

    Perhaphs that's a workable solution? At least that's how I abuse it sometimes ;)

    Peter

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 12, 2009 @ 16:37
    Dirk De Grave
    0

    work item created on Codeplex - now go and vote!

     

    Cheers,

    /Dirk

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 12, 2009 @ 18:36
    Shannon Deminick
    0

    This can easily be done with event handlers or old action handlers.

    But, default values have long been a request from everyone for a while. The only good way i can see this happening is specifying a default value for the property at document type level. If we do this, its gonna mean a database change for 4.1... doh! so far there's been no db changes for 4.1, this could be the first one :( Unless anyone has a better idea as to where to store a default value?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Aug 12, 2009 @ 23:04
    Sebastiaan Janssen
    0

    To solve this (having a checkbox datatype that is already checked on), I used and modified the code foud in this old forum post. This worked perfectly for  me. No action handlers needed.

  • Richard Soeteman 4045 posts 12898 karma points MVP 2x
    Aug 13, 2009 @ 09:09
    Richard Soeteman
    0

    @Dirk Voted

    But still I do think a normal default value is not going to help you all the time. I have a lot of customers that are affraid of the Properties tab. So what I normally do is creat a pageTitle property and fill that with the nodeName value. Or I use a publication date property that I fill with the current date. I'm hoping that these scenarios will also be possible when default values will be implemented in Umbraco.

  • Max 2 posts 22 karma points
    Aug 14, 2009 @ 10:54
    Max
    0

    Dirk, I would love that feature. Voted!

  • Pete 152 posts 176 karma points
    Aug 21, 2009 @ 11:45
    Pete
    0

    Can someone point me at documentation for modifying values using ActionHandlers or UmbracoEvents? 

     

    I'd like to set a date to default to the current DateTime if no date is entered. 

  • Richard Soeteman 4045 posts 12898 karma points MVP 2x
    Aug 21, 2009 @ 12:52
    Richard Soeteman
    1

    Hi Peter,

    Did you check example 1 of the wiki I've created. I set the expire date there but with a little modification it should work in your case.

  • Christian Palm 278 posts 273 karma points
    Oct 22, 2009 @ 09:23
    Christian Palm
    0

    Got my vote on codeplex :-)

    One way to handle this is by creating default values on content nodes in the site structure and use event handlers like the other proposals

    -Content
    --Home
    ---Page 1 (based on document type NormalPage)
    ---Page 2 (based on document type NewsPage)
    --Default values
    ---NormalPage (based on document type NormalPage)
    ---NewsPage (based on document type NewsPage)

    When creating a new node on the site structure (under Content/Home), an eventhandler should check to see if the newly created node DocumentType exist under Default values. If true, then copy values from the Node under Default values to the newly created node.

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Jan 24, 2010 @ 16:17
    Morten Christensen
    1

    Hi Guys,

    I have created a package that adds the ability to create standard values for your document types, since this has long been I requested feature and since no one has already created a package (as far as I know).

    And I was able to reuse a lot of the code that is already available in Umbraco, so I only had to create a small table in the db to keep track of the document types.

    Go check it out:
    http://our.umbraco.org/projects/standard-values-in-umbraco

    - Morten

  • Developer 22 posts 123 karma points
    Nov 23, 2018 @ 08:50
    Developer
    0

    Hello,

    If anyone needs this still then Here is good article.

Please Sign in or register to post replies

Write your reply to:

Draft