Copied to clipboard

Flag this post as spam?

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


  • Nikola Petkovic 64 posts 63 karma points
    Mar 30, 2009 @ 14:16
    Nikola Petkovic
    0

    DocumentType.BeforeSave fires after saving Properties

    I wanted to track changes to property aliases when saving DocumentType.

    Im not sure if that is the wanted functionality, but DocumentType.BeforeSave is fired after all Property changes are saved, so I thought better to ask it here first, before posting the issue to codeplex.



    I traced the source code and found out that private method ContentTypeControlNew.saveProperties is called immediately after the button 'Save' is clicked, so I dont get the point of having BeforeSave eventhandler of DocumentType if it works this way...

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 30, 2009 @ 15:45
    Dirk De Grave
    0

    Hi,

    I'm just hitting the same wall today! And yes, indeed, for example setting a different template (if multiple templates available for current doc type) will get persisted even if you're cancelling out the event!

    It's also a bug to me!

    And there's more than a single property being affected. Also, text, update date, release date, expire date are also persisted to the database before being able to cancel out the event.

    Please add to Codeplex, as this is a serious issue.

    Cheers,
    /Dirk

  • Nikola Petkovic 64 posts 63 karma points
    Mar 30, 2009 @ 17:16
    Nikola Petkovic
    0

    Thanks Dirk!

    you can vote up our issue here:
    http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=21847

    Cheers,
    Nikola

  • Nikola Petkovic 64 posts 63 karma points
    Mar 31, 2009 @ 13:09
    Nikola Petkovic
    0

    I tried to add BeforeSave eventhandler for Documents as well (as Update actionhandler cannot track the value of a property before updating the doc), and it actually behave similar -
    Changes are preserved before I handle BeforeSave event at docs.

    Can anyone confirm this issue?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 31, 2009 @ 13:16
    Dirk De Grave
    0

    Hi ni5ni6,

    I WAS using documents!! I must have misread your first post, because i was hitting that wall registering for the Document.BeforeSave event. Anyway, it's an issue.

    Regards,
    /Dirk

  • Nikola Petkovic 64 posts 63 karma points
    Mar 31, 2009 @ 15:33
    Nikola Petkovic
    0

    Haha... good,
    ](*,) its funny.. neither I did notice that you were talking about documents..

    Thanks again Dirk!

  • Gareth 20 posts 24 karma points
    Jul 26, 2009 @ 13:11
    Gareth
    0

    I wonder if this is related to a problem I am having :

    I created a custom TextString property on a document type and also a Document.BeforeSave handler. In the handler I set the property to a value. When I save the form my handler is hit and the form screen is refreshed however the property is still blank despite the value being set. When I publish the document I can see the property value is set correctly in the umbraco.config xml but the property still displays blank in the document editting form.

    The only way to get the property value to appear in the form is by clicking on another document and then back again to "refresh" the values. 

    Is it the same? Could it be a caching issue?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jul 26, 2009 @ 13:40
    Aaron Powell
    0

    For the record I covered this error in a recent blog post - http://www.aaron-powell.com/blog/july-2009/the-great-umbraco-api-misconception.aspx

    In addition it is something I'm *trying* to fix for the upcoming 4.1 release, I think I have it solved but we'll wait for testing during the alpha/ beta phase to determine that for me :)

  • Gareth 20 posts 24 karma points
    Jul 26, 2009 @ 14:03
    Gareth
    0

    Not sure this is the same problem I have, I'm not trying to cancel the event and I want the value to be saved but it just isn't displayed on the edit form after I programmatically set it in Document_BeforeSave().

    Am I missing something about your post and how it relates to my problem?

  • Gareth 20 posts 24 karma points
    Jul 26, 2009 @ 16:47
    Gareth
    0

    I get it, I'm poaching the thread! I'll start a new one

  • Anders Rähr 22 posts 46 karma points
    Jun 30, 2010 @ 19:18
    Anders Rähr
    0

    Hate to bring this old topic back up, but im trying to implement the DocumentType.BeforeSave to control which backend users that can manipulate tabs. 

    Im using umb 4.5 and trying to do something like this

    void DocumentType_BeforeSave(DocumentType sender, SaveEventArgs e)

            {

                    DocumentType oldSender = DocumentType.GetByAlias(sender.Alias);

     

    oldSender is now filled with the new values... 

    Looking at http://www.aaron-powell.com/blog/july-2009/the-great-umbraco-api-misconception.aspx i understand the issues, but looking at http://umbraco.codeplex.com/workitem/21847?FocusElement=CommentTextBox it says fixes by Niels...

    what's the status of this? 

Please Sign in or register to post replies

Write your reply to:

Draft