1
votes

I am developing web application in Umbraco 7.2.5 and MVC. Can you please help me on implementing the below requirements inside umbraco.

  1. Implementing Tag Cloud inside umbraco by adding as a datatype
  2. 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");
    }
}
1
Is there any way I could prevent submitting the form with something like this and then display the message. eventsService.on("formSubmitting", function (e, args) { return false;}Vinod Kumar

1 Answers

0
votes

The BasePage.Current.ClientTools stuff doesn't work in the Angular bits of v7, as that's for the ASP.Net MasterPages stuff. As far as I know, there is currently no server side way of emitting popup messages (although I now it's scheduled for release soon). According the issue for this on the issue tracker, it's due in 7.3! See issue comments here