Wednesday, November 15, 2017

Attach-File-Modal-Dialog-Sharepoint-2013

HTML Uploader :

<div id="FileUploaded"></div><a href="javascript:openpageindialog();">Attach Supporting Documents</a>

Script :

It opens the Attach File.aspx page in modal pop up.

function openpageindialog() {
    console.log(itemId);
    var options = {
                url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/AttachFile.aspx?ListId={GUID}&ItemId='+itemId,
                title: 'Add Attachment',
                width:700,
                height: 200,
                dialogReturnValueCallback: function(result, fileAdded){
console.log(result);
                if(result == SP.UI.DialogResult.OK){
                    alert("file added");
                }
            }            
            }; 
            SP.UI.ModalDialog.showModalDialog(options);
        }

No comments:

Post a Comment

Clearing Person/Group Values

To clear out or empty the values in person or group columns, how you do it depends on if the column is single-value or multi-value. For ...