Sharepoint - How to create a link for List's NewForm.aspx that opens in Modal Dialog?

Try to use the following code within a Script Editor / Content Editor:

 <script>
function openDialog(pageUrl) { 
var options = {
    url: pageUrl,
    title: 'Title of the Dialog',
    allowMaximize: false,
    showClose: true,
    width: 500,
    height: 500
};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);       
}

</script> 
<a href="#" onclick="openDialog('http://SharePointSite/Lists/WebEvents/NewForm.aspx');">New Form</a>

Note :

  • To show Maximize button set allowMaximize: true,

OutPut:

enter image description here

Check also the detail steps that matched with your situation at Open a link via Modal Dialog in SharePoint

Tags:

Modal Dialog