Give users the ability to add items to a list without showing the entire list web part. In my example, I’ve added a “Submit Request” button to a Document Set Welcome Page. Clicking this will open the New Item form for my Tickets list.
<script type="text/javascript"> function displayLayover(url) { var options = SP.UI.$create_DialogOptions(); options.url = url; options.dialogReturnValueCallback = Function.createDelegate( null, null); SP.UI.ModalDialog.showModalDialog(options); } </script> <input type="button" onclick='javascript:displayLayover("/sites/sandbox/mustard/Lists/Tickets/NewForm.aspx")' value="Submit Request">
Steps:
1. Add a Script Editor web part to your page.
2. Click EDIT SNIPPET.
3. Replace the URL in this line with the path to your list’s New Item form (you can also change what the button says by changing the ‘value’):
<input type="button" onclick='javascript:displayLayover("/sites/sandbox/mustard/Lists/Tickets/NewForm.aspx")' value="Submit Request">
NOTE: If your URL looks something like this: /sites/sandbox/mustard/_layouts/15/start.aspx#/Lists/Tickets/NewForm.aspx, remove /_layouts/15/start.aspx# from the path.
4. Click Insert and save the page.
5. To test, click the new “Submit Request” button.
6. Add some information and click Save.
7. Navigate to the list to confirm.