Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Apr 22, 2010 @ 13:37
    Ismail Mayat
    0

    Cancel publish from datatype

    Hello,

    Reckon the answer is no but here goes.  Is it possible to cancel a page publish from a datatype?  He is my scenario, I have created a datatype that uses update panel and textchanged property of textbox with autopostback set to true.  

    So after user types something into textbox the textchanged event is fired that does a lookup in umbraco xml content to see if that value has already been entered for any other document if found then textbox goes red and user gets message.  However user can still publish the page.  I can add action handler to do same test on publish and cancel event that way but was wondering if it could be done through the datatype?

    Also another though when creating custom datatype is it possible to plugin your own custom validator for it?  Out of the box when you property to document type you can  either make it mandatory or put regex validation not custom validation?  Hmm maybe time to raise new feature on codeplex.

    Regards

    Ismail

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Apr 22, 2010 @ 15:29
    Aaron Powell
    0

    It should be do-able, because the DataType is created before the Document.BeforePublish event is raised. If you're adding it in the ctor of the Data Type then I can't see why it would be a problem.

    The Document.BeforePublish event can be canceled no problems, well that's what my experience has said :P

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Apr 22, 2010 @ 15:46
    Ismail Mayat
    0

    Slace,

    The data type is using umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor so where abouts and how in code in the datatype do i cancel the event?

    Regards

    Ismail

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Apr 22, 2010 @ 16:03
    Aaron Powell
    0

    Oh right, I am pretty sure that OnLoad will fire. Do a search for Page.LoadControl and the life cycle of that (the Usercontrol wrapper just uses LoadControl internally).

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Apr 23, 2010 @ 13:16
    Ismail Mayat
    0

    Slace,

    I was going about this totally the wrong way.  Just added a custom validator to my data type and that stop publishing simples!

    Regards

    Ismail

  • Sherry Ann Hernandez 320 posts 344 karma points
    Mar 01, 2011 @ 11:33
    Sherry Ann Hernandez
    0

    Hi Ismail,

    How do you add the custom validator in to your datatype? I was also having a problem on how to do that.

Please Sign in or register to post replies

Write your reply to:

Draft