locked
Create "add new item" link to open in dialog RRS feed

  • Question

  • Rather than use the default "Add new item" link for a list I'd like to create my own link at the top of my page or from the quicklaunch. The issue I'm seeing is then when I copy the link from the system created link and then paste it into a custom link is that it opens in a new page rather than in a dialog.

    Can someone help me out on this? Thanks very much.

    Monday, March 22, 2010 7:46 PM

Answers

All replies

  • That dialog mechanism is a function of the list itself, I believe.  Just copying the URL to another place doesn't give it an anchor for opening in dialog, I don't believe.
    SharePoint Architect || My Blog
    Tuesday, March 23, 2010 1:23 AM
  • I havn't tried it my self but I stumpled over this earlier looking for something completely different

    How to Display a SharePoint Dialog from Ribbon Button and Get Selected Item Context
    http://blogs.msdn.com/jfrost/archive/2009/11/08/how-to-display-a-sharepoint-dialog-from-ribbon-button-and-get-selected-item-context.aspx

    It seems that there is something in the JavaScript OM that could help you open it as a dialog.

    -- 
    Christian

    • Marked as answer by Mr Jstin Thursday, March 25, 2010 10:12 PM
    Tuesday, March 23, 2010 7:39 PM
  • Yeah, I was afraid of that BUT I was able to get a custom ribbon to do it. Although not optimal, it will have to do. Thanks both of you.

    Thursday, March 25, 2010 10:11 PM
  • I just ran into the same issue and came across this link: http://pacsharepoint.com/2010/07/open-list-item-modal-dialog-lightbox.html

    In case the URL above get's moved or deleted, here is the code you can add to code below.  This worked for me.

    <script type="text/javascript"> 
    var options = { 
    url: "Lists/MyList/NewForm.aspx", 
        title: "Text to display as title of Lightbox", 
        allowMaximize: true, 
        showClose: true, 
        width: 625, 
        height: 525, 
        dialogReturnValueCallback: silentCallback}; 
    function open() {SP.UI.ModalDialog.showModalDialog(options);} 
    function silentCallback(dialogResult, returnValue) { 
    } 
    function refreshCallback(dialogResult, returnValue) { 
      SP.UI.Notify.addNotification('Operation Successful!'); 
      SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK); 
    } 
    </script> 
    <a href="javascript:open()">Text to display for link</a>
    
    • Proposed as answer by Alec Pojidaev Friday, July 15, 2011 5:54 PM
    Sunday, October 17, 2010 1:11 AM