I am developing web application in Umbraco 7.2.5 and MVC
. Can you please help me on implementing the below requirements inside umbraco.
- Implementing Tag Cloud inside umbraco by adding as a datatype
- Category Name - Unique Validation
Regarding second point, my requirement is if admin enters the existing Category Name and tries to publish he should get a validation message and publish shouldn't happen.I think Unique Validation is not available by default in Umbraco 7.
If the entered Category name is already available Umbraco Appends (1) to it like Samsung and Samsung (1). After analysis I found a way but I am facing some issue in that too. Can you please help.
Validating the name in the Before Save Event. The problem with this approach is umbraco displays some generic message "Publish was cancelled by a third-party plugin"
, which Admin won’t understand the exact reason. I tried customizing but couldn’t succeed. Is there any way I could customize the message. Below is the code i tried. Is there any event in javascript to fire when Publishing is performed.
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) {
ContentService.Saving += ValidateName;
}
private void ValidateName(IContentService sender, Umbraco.Core.Events.SaveEventArgs e) {.....
if (nameAlreadyExists) {
e.Cancel = true;
e.Cancel = true;
BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "error", "Already Exists");
}
}