Tuesday, January 3, 2017

How to skip an edit form after uploading a single document in SP 2013

How to skip an edit form after uploading a single document in SP 2013

I would like to set all document properties programmatically inside the event handler. i do not manage to skip an edit form after the document is uloaded.

Solution :

Javascript solution for sharepoint 2013


In SP.UI.Dialog, there is a function to close a dialog : commonModalDialogClose
Takes two parameters, commonModalDialogClose(dialogResult, returnValue)
dialogResult is an enum (here is an extract from SP.UI.Dialog.js :
SP.UI.DialogResult.prototype = {
    invalid: -1,
    cancel: 0,
    OK: 1
};
Solution : When using the upload.aspx page, you will be redirected to the EditForm.aspxincluding a QueryString parameter, Mode, that will be tagged as Upload. Using that information, the dialog can be closed. The QueryString parameter is retrieved using the GetUrlKeyValueSharePoint native function.
GetUrlKeyValue(keyName, bNoDecode, url, bCaseInsensitive)
add the following into the library EditForm.aspx using JSLink
(function (){
    var mode = GetUrlKeyValue("Mode", false, window.location.href, true);

    if (mode == "Upload")
    {
        //commonModalDialogClose(dialogresult, resultValue)
        //dialog result : -1 = invalid; 0 = cancel; 1 = ok
        //resultValue : text
        commonModalDialogClose(0, null);
    }
})();
Hope this help,

Sharepoint Designer 2013, XSLT List View Options ribbon option is not showing

Sharepoint Designer 2013, XSLT List View Options ribbon option is not showing I have an ordinary Wiki Page, also tried making an Article...