I have a list that opens items in the modal dialog boxes. Now I would like to have a link on another page that will open the dialog for the new item form. Tried a lot of other suggestions here and elsewhere - nothing works so far.

2 Answers 2


So, if I understand correctly, you have a link on some page and you want to open a New Form of some list in the Modal Dialog when user clicks the link, right? You can do that with JavaScript. The code will look similar to that:

function openDialog(listId) {
SP.SOD.executeOrDelayUntilScriptLoaded(function () {
        url: 'http://yoursite/yourweb/_layouts/15/listform.aspx?PageType=8&ListID={' + listId + '}&IsDlg=1',
        title: 'New Item',
        allowMaximize: false,
        showClose: true,
        width: 500,
        height: 300,
        dialogReturnValueCallback: function(dialogResult, returnValue) {
}, 'sp.ui.dialog.js');

Where listId parameter is an ID of the list where new item should be created. You can assign call this function from your link onclick event handler.

Or you can probably even try to provide the whole code in your href attribute like:

<a href="javascript:..."></a>

But I wouldn't recommend that


Add Script Editor web part in a page, add the following code in the Script Editor web part:

 <script type="text/javascript">

 function displayLayover(url) {

 var options = SP.UI.$create_DialogOptions();

 options.url = url;

 options.dialogReturnValueCallback = Function.createDelegate(

 null, null);



<a href='javascript:displayLayover("/Lists/list1/NewForm.aspx?IsDlg=1")'>new Item </a>

Note:change list1 to your list.



  • I saw this reference and tried the solution - but no joy. The dialog opened is blank/empty.
    – Quasimodo
    Commented Jan 23, 2018 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.