Copied to clipboard

Flag this post as spam?

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


  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    May 09, 2016 @ 00:25
    Nathan Woulfe
    0

    Cancel save on client side

    Trying to cancel a save event on the client, based on a property failing a particular validation, but am getting a 500 error dialog in the backoffice.

    Any ideas on how to handle this? Preference is to keep it client side as it's part of a suite of httpinterceptors managing other simple business logic.

    function contentSave($q) { 
        var canceller = $q.defer();
    
        return {
            request: function (request) {
                 // check property, set cancel = true if invalide
    
                 if  (cancel) {
                     request.timeout = canceller.promise;
                     canceller.resolve();
    
                     // save is cancelled, but ysod dialog is triggered, with no error message as the request was never sent.
                 }
                 return request || $q.when(request);
            }
        }
    }   
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies