Copied to clipboard

Flag this post as spam?

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


  • Roman Kalius 6 posts 76 karma points
    Jan 24, 2022 @ 11:21
    Roman Kalius
    0

    Show dialog on ContentSavingNotificationHandler.HandleAsync

    Hi, I have some problems and have no idea, how to show a dialog popup on SavingContent event in method HandleAsync. Some code here:

         public class ContentSavingNotificationHandler : INotificationAsyncHandler<ContentSavingNotification>
      {
        private readonly IContentService contentService;
        private readonly IEventService eventService;
        public ContentSavingNotificationHandler(IContentService contentService
          , IEventService eventService)
        {
          this.contentService = contentService;
          this.eventService = eventService;
        }
        public Task HandleAsync(ContentSavingNotification notification, CancellationToken cancellationToken)
        {
          if(eventService.GetSomething())
          // want to show popup from here
        }
      }
    

    has somebody idea how to do it?

  • Dennis 75 posts 397 karma points MVP 2x
    Jan 26, 2022 @ 14:30
    Dennis
    0

    Hi there,

    Could you elaborate on what exactly you are trying to achieve?

    As far as I know, it's not a thing to trigger a popup in the frontend from an event in the backend, especially because an event can also be fired from background processes.

  • Roman Kalius 6 posts 76 karma points
    Jan 27, 2022 @ 06:43
    Roman Kalius
    0

    hi, thanks you for your interest. What I want to do? I want to show a dialog window ( just after press save/publish button, and before save method ), where user can do some confirmation ( if clicks Ok - save procedure continues, else stop - save process is canceled )...

  • Dennis 75 posts 397 karma points MVP 2x
    Jan 27, 2022 @ 15:18
    Dennis
    0

    Ah, I see. Well once the users clicks on save or save & publish, this action is set in motion and once your event handler triggers, it's too late to give your users any options.

    To change the behaviour on save or on save & publish, you'd have to do some magic to the buttons in the umbraco backoffice.

    Here is an example of a plugin that changes the behaviour on certain buttons by intercepting the request that gets the html for the button and replacing it with a new implementation.

    It's a complicated process and should be considered a hack. You may want to consider an alternative.

Please Sign in or register to post replies

Write your reply to:

Draft