0

I'm trying to include a link in a site page that leads to a specific element of a list..

I need the link to open the element détails in a modal dialog box instead of sending me directly into the element details within the list..

Is there a way that any links to elements in a specific links automatically open in a modal dialog box?

2

You can do it using jQuery like:

<button onclick="javascript:popup(); return false;">Modal</button>

function popup(){
 SP.UI.ModalDialog.showModalDialog({ 
            url: "URL of List", 
            title: "Title of page", 
            allowMaximize: true, 
            showClose: true, 
            width: 850, 
            height: 600, 
            dialogReturnValueCallback: newCallback 
        });
function newCallback(dialogResult, returnValue) { 
   SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK); 
}
}
0

I finally figured out to make it work by adding some code directly to the hyperlink.

javascript:SP.UI.ModalDialog.ShowPopupDialog("/SharePointSite/Lists/ListId/DispForm.aspx?ID=1");

links are now opening correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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