2

I have the following line of code which shows me the dialog of my list:

<a href="javascript:SP.UI.ModalDialog.ShowPopupDialog('http://mysite/Lists/mylist/NewForm.aspx');">Add New Item</a>

but instead of dialog I want to open a new window for NewForm of my list.

How can I make this via JavaScript?

1 Answer 1

3

Try to remove

javascript:SP.UI.ModalDialog.ShowPopupDialog('');

to be like

<a href="http://mysite/Lists/mylist/NewForm.aspx" target="_blank">Add New Item</a>

Using target="_blank" : to Opens the linked document in a new window or tab

[Update]

based on your request at comments ,

Use the following code and change the height and width

For more details, check the detail steps at Open a link via Modal Dialog in SharePoint

<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');">Central Admin</a>
2
  • yes but I need to be just like dialog with custom width and height
    – Iamnderon
    Commented Aug 31, 2016 at 9:23
  • Please , Check my updated answer Commented Aug 31, 2016 at 9:28

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.