0

I have a custom display/edit form for my list. After the form is submitted and the user is redirected back to list view, I want to show a notification that 'new item has been added' or 'changes were successfully saved'. I was thinking about using the SP.UI.Status or SP.UI.Notify, but not sure how to use that on list view. Perhaps some js web part and a query string parameter to determine if notification should be added?

0

You can use Query String Parameter.

Add query string Status=Saved or Status=Update

Now use below JavaScript code

jQuery(document).ready(function(){
    var param = getParameterByName("Saved");

    if(Status == "Saved") {
        SP.UI.Notify.addNotification("new item has been added", false);
    }
    else if(Status == "Update") {
        SP.UI.Notify.addNotification("changes were successfully saved", false);
    }
});

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.