1
 var options = 
    {
        url: "http://siteUrl/_layouts/Page.aspx?ID=6",
            width: 800,
            height: 600,
        title: 'Attach File',
    };

    SP.UI.ModalDialog.showModalDialog(options);

I have tried this javascript code. But it gives me error. Error in url of modal popup .It will redirect to this following url: res://ieframe.dll/http_404.htm#SiteURL?IsDlg=1

5

4 Answers 4

1

After looking closely on your code I see that you are having one extra "," after the title. That may case a problem for you. It should be defined like this:

var options = {
title: "My Dialog Title",
width: 400,
height: 600,
url: "/_layouts/DialogPage.aspx" };

No "," after the last parameter.

2
  • Thnk you so much @Magnus Hasson. It's working for me... Mar 6, 2013 at 5:54
  • Welcome .. sometimes it is the smallest things. I made that error once myself :) Mar 6, 2013 at 7:14
1
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

Try this

0

Can i suggest the following? This is taken from a SP2010 solutions i developed but I'm sure it will work just the same...

<a id="idHomePageNewItem" onclick="javascript:NewItem2(event,&quot;http://siteUrl/_layouts/Page.aspx?ID=6&amp;RootFolder=&quot;);javascript:return false;" href="/_layouts/Page.aspx?ID=6&amp;RootFolder=" target="_self" style="width: 212px; height: 50px;">Your link text here</a>

Hope this helps.

S

2
  • Hello @Stephen but how can i write this following anchor tag in my custom page?? Mar 5, 2013 at 12:34
  • I made my page a webpart page and added it via the HTML source editor...
    – Stephen
    Mar 5, 2013 at 13:54
0

I have exactly the same system's behavior when page didn't exist with such URL (i thought it was, but actually it wasn't - usually, the simplest mistakes is harder to find). I always start checking URL first now - hopefully, it helps someone.

Your Answer

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

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