Question

In my webpart when I click new item I get:

enter image description here Is there a way to make this box appear to create a new list item when I link a link?

I want to have something hyperlinked like "Send Feedback" that people can click and get a callout box like this.

Let me know how to communicate my question better, Thankyou.

Was it helpful?

Solution

Use the SP.UI.ModalDialog.showModalDialog function to open a dialog like this:

function openURL(){

SP.UI.ModalDialog.showModalDialog({ 
            url: "pageurl.aspx", 
            title: "Feedback", 
            allowMaximize: true, 
            showClose: true, 
            width: 800, 
            height: 600, 

            dialogReturnValueCallback: newCallback 
        });
function newCallback(dialogResult, returnValue) { 
       SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK); 
}
}

Update

You can use this function like

<button onclick="javascript:return openURL();">Feedback</button>

You can add a javascript file using the content web part.

Edit page -> Add web part -> Media and content -> Content editor -> Add

Edit the source of the web part and add the following code into it:

<script src="/sites/subsite/list/SiteAssets/file.js" type="text/javascript"></script><script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>

Add the js file under Site Assets using SharePoint Designer.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top