Open SharePoint 2013 list form in dialog box on button click using JavaScript

Open SharePoint 2013 list form in dialog box on button click using JavaScript

This SharePoint 2013 tutorial explains, how to open a SharePoint 2013 list form in a dialog box on a button click using JavaScript in SharePoint 2013. This we can achieve using a simple JavaScript script.

Open SharePoint 2013 list form in dialog box on button click using JavaScript

So for this, first of all, I have created a web part page. You can check this article to know how to create a web part page in SharePoint 2013.

SharePoint deveopment training course

Here you can use script editor or content editor web part to insert the javascript code into the page. Content editor web part is fine when you want to insert HTML code but if I have HTML or script, I always prefer to use in script editor web part.

If you will add JavaScript to your page using the Content Editor Web Part in SharePoint 2013 then the script tag entries will be removed. So I always prefer to use the script editor web part.

To add a script editor web part to the page, edit the page then click on “Add a Web Part” link and then from the web part categories, select “Media and Content” and then choose Script Editor, then click on Add. Once the web part added, then you can see EDIT SNIPPET and put the below code which looks like below:

<input id="btnClick" onclick="javascript:OpenPopUpPage('https://onlysharepoint2013.sharepoint.com/Lists/TestList/NewForm.aspx');" type="button" value="Ope New Form"/>
Open SharePoint 2013 list form in dialog box on button click using JavaScript
Open SharePoint 2013 list form in dialog box on button click using JavaScript

Now Save the page, When you click on the button, the new form will open in a dialog box.

Hope this SharePoint tutorial explains, how to open SharePoint 2013 list form in a dialog box on button click using JavaScript.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →