none
Image open to new item form in dialog

    Question

  • Hi All,

    I plan on having two images side by side. One link to external site, and one id like to open the new item form for an existing list. I currently can only have the link open to a new page and wanted the link to open in dialog.

    I need a solution within the a href tag, unless someone has a better idea :)

    Friday, July 18, 2014 2:10 PM

Answers

  • <script type="text/javascript">
    var options = { 
    url: "http://blahblah/site/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 for link goes riiight here.</a>
    This is what I had to do. I placed this in a content editor, and added an image source between the href tag. works like a charm. You can change the size and title of the dialog box.
    • Marked as answer by Palumbob413 Friday, July 18, 2014 6:40 PM
    Friday, July 18, 2014 6:40 PM

All replies

  • <script type="text/javascript">
    var options = { 
    url: "http://blahblah/site/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 for link goes riiight here.</a>
    This is what I had to do. I placed this in a content editor, and added an image source between the href tag. works like a charm. You can change the size and title of the dialog box.
    • Marked as answer by Palumbob413 Friday, July 18, 2014 6:40 PM
    Friday, July 18, 2014 6:40 PM
  • Hi,

    Thanks for your sharing.

    Cheers,

    Jason


    Jason Guo
    TechNet Community Support

    Monday, July 21, 2014 8:12 AM
    Moderator