Copied to clipboard

Flag this post as spam?

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


  • Kris Dyson 54 posts 79 karma points
    Mar 10, 2010 @ 17:57
    Kris Dyson
    0

    Hide media type alias - or force reload

    Hi there, I have created my own Media Type and created a field with the alias 'guid'.

    I have also intercepted the Media_BeforeSave event in AppBase.  In the code I'm creating a new guid and assigning it to the guid field. However, when the Media Type is re-displayed on screen, (having clicked save and triggered Media_BeforeSave), the Guid field in the Umbraco GUI is not populated with the latest value assigned by the code.

    If I reload the Media Type, then all is well, because it's re-retrieving from storage.

    So is there a way to persist data with a media type which the user/content editor does not have access to?  Or is there a way to force umbraco to reload the Media Type after save?

    The problem is that if someone clicks save twice, then we lose data... 

    thanks for your help

    Kris

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Mar 10, 2010 @ 18:31
    Lee Kelleher
    0

    Hi Kristan,

    It sounds like you need a custom data-type that will generate a Guid for you. That way you wouldn't need to hook into the event model (i.e. Media_BeforeSave).

    Here's a couple of tutorials:

    http://www.nibble.be/?p=24

    http://www.nibble.be/?p=50

    If you are having no joy with it, let us know... might be tempted to do a code snippet! ;-)

    Cheers, Lee.

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Mar 10, 2010 @ 18:33
    Lee Kelleher
    0

    Found a better link...  making use of the new AbstractDataEditor class:

    http://www.nibble.be/?p=62

  • Kris Dyson 54 posts 79 karma points
    Mar 10, 2010 @ 18:39
    Kris Dyson
    1

    Hi there, well it's OK, the hook into before save is for some other processing which works fine... actually in the end i used the Node's Unique ID, as this works perfectly - plus I didn't need to refresh the guid every time, so all is well.

    thanks again!!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies