SharePoint New Item Form Actions

The following post describes 3 of the many new Form Actions available in SharePoint.

Cancel:
This example shows how to return to home page after user cancels creating the item.

$(document).ready(function() {
    $('input[value=Cancel]').click(function() {
        window.location.replace("https://<siteurl>/sites/Site/SitePages/Home.aspx");
    });
});

Pre-Save:
This example shows how to show an alert and wait for OK or Cancel action.

function PreSaveAction() {
    if (confirm("Proceed with saving the item?"))
        return true;
    else
        return false;
}

Post-Save:
This example shows how to return to home page after user creates the item.

function PostSaveAction() {
    window.location.replace = "https:///sites/Site/SitePages/Home.aspx";
    return true;
}

Do make a note that above code requires the Jquery is referenced in the page.

Sharepoint list quick edit not available?

When you are vieweing a custom view and don’t see the “Edit” menu also called as “Quick Edit”, make sure that particular view has the “Tabular View” configured. This is one of the reasons why sharepoint list’s quick edit is not available in custom viewes.

Steps to configure “Tabular View” to enable quick edit.

  1. Goto -> List Settings -> Views -> Click on the view where the “Edit” doesn’t show up
  2. In the view edit page, expand “Tabular View” if not already expanded
  3. Check the “Allow individual item checkboxes ” checkbox.
  4. Click “OK” to save the view settings

Now the quick edit should have been enabled.

Note: This is applicable for modern view available in Office 365, SharePoint 2016 & SharePoint 2013.