CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Really good examples how to detect a sharepoint page in edit mode.

function isEditMode() {
    var publishingEdit = window.g_disableCheckoutInEditMode,
        form = document.forms[MSOWebPartPageFormName],
        input = form.MSOLayout_InDesignMode || form._wikiPageMode;
    return !!(publishingEdit || (input && input.value));
}

I published this even as an answer on sharepoint SE.

.Net Goodies

In this post I am going to explain different ways to detect SharePoint page mode through client side scripts

If the page is publishing then we can query following  JavaScript variable to find the Page status

if(g_disableCheckoutInEditMode == true) {
   alert('Page is in edit mode');
}
else {
   alert('Page is in display mode');
}

Another options for publishing page

//Add following in master page


    var IsEditMode = false;


<PublishingWebControls:EditModePanel runat="server" id="EditModePanelToFindEditMode">
     
        IsEditMode = true;
     
</PublishingWebControls:EditModePanel>

//Now through script you can use the variable IsEditMode

We can also query the PageState object which has property ViewModeIsEdit. The problem with this is because the object gets initialized only after loading sp.ribbon.js.

Another option

var IsEditMode = 
document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; 
if (IsEditMode == "1") { // page is in edit mode } 
else { // page is in browse mode }

For WIKI pages

var…

View original post 27 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Discovering SharePoint

And going crazy doing it

Bram de Jager talking Office 365, SharePoint and Azure

My view and thoughts on Productivity and more.

My programming life

and everything in between

SharePoint Development Lab by @avishnyakov

It is a good place to share some SharePoint stories and development practices.

SharePoint Dragons

Nikander & Margriet on SharePoint

RealActivity - Real-time and trustworthy

Blog site of founder, RealActivty - Paul J. Swider

Mai Omar Desouki - Avid SharePointer

Egyptian & Vodafoner - Senior SharePoint Consultant

Cameron Dwyer | Office 365, SharePoint, Outlook, OnePlace Solutions

Office 365, SharePoint, OnePlace Solutions & Life's Other Little Wonders

paul.tavares

Me and My doings!

Share SharePoint Points!!

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

SPJoel

SharePoint for everyone

SharePointRyan

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode, ya mama

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint

blksthl

Mostly what I know about SharePoint - CommunicoCuspis

%d bloggers like this: