1

I'm dealing with a situation where I would like to enter sites list item already in edit mode. Normally, when I would like to edit this page I would look to the ribbon and click the Edit link there, which would change the display mode to edit. I've learned about a way to do it programmatically reusing ribbon actions (PageStateCommands) like

SP.Ribbon.PageState.Handlers.showStateChangeDialog(PageStateGroupEdit, SP.Ribbon.PageState.ImportedNativeData.CommandHandlers[PageStateGroupEdit]);

The SP.Ribbon.PageState however is unavailable if the item is checked in.
Is it possible to use it anyway by loading the SP.Ribbon somehow? The workaround I have right now is that I checkout the page when I know the user wants to get there. The user gets to the details page and is then reloaded with the edit view. The most optimal approach would be to send him/her straight to the edit mode.
Please let me know if I've made anything unclear and thanks for all possible ideas. Kind regards.

1

If you want to enter the page in edit mode just add ?ControlMode=Edit&DisplayMode=Design to your URL.

If you want the page list item in edit mode you can get the url via JS like this:

var ctx = SP.ClientContext.get_current();
var list = ctx.get_lists().getById(_spPageContextInfo.pageListId);

ctx.load(list, 'DefaultEditFormUrl');
ctx.executeQueryAsync(
    function () {
        var editModeUrl = list.get_defaultEditFormUrl() + '?ID=' + _spPageContextInfo.pageItemId;
    },
    function (sender, args) {
        //error
    }
);

If you want to open any item from any list, you need to get the EditFormUrl and the item ID. This can be done with similar JS code.

  • Yes! Thank you. the URL parameters worked for me. Cheers! – kruczer Jun 1 '15 at 8:21

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.