Total Pageviews

172,361

29 May 2013

Detect Edit Mode with Javascript on SharePoint pages or SPListitem forms

This JavaScript function will tell you if we are in the List Edit form:

var isEditForm = function ()
{
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    if (sPage == "EditForm.aspx")
    return true;
    else return false;
}


And this one will tell you if we are in edit mode on publishing, web part or wiki pages
var isinEditMode = function() {
    var isEditMode = false;
    try {
        var inDesignMode = document.forms[window.MSOWebPartPageFormName].MSOLayout_InDesignMode.value;

        if (inDesignMode == "1") {
            isEditMode = true;

        }
    } catch(e) {
    }

    try {
        var wikiInEditMode = document.forms[window.MSOWebPartPageFormName]._wikiPageMode.value;
        if (wikiInEditMode == "Edit") {
            isEditMode = true;
        }
    } catch(e) {

    }

    return isEditMode;
};

14 May 2013

Applying custom page to all subsites

You've create a custom master page and want to apply it to all of your subsites. Use this link to do just that:

/_layouts/changesitemasterpage.aspx

Warning: Publishing Infrastructure Feature must be enabled on your site collection.