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.
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
The data type is using umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor so where abouts and how in code in the datatype do i cancel the event?
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).
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
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
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
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).
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
Hi Ismail,
How do you add the custom validator in to your datatype? I was also having a problem on how to do that.
is working on a reply...