Click here to Skip to main content
15,890,512 members
Articles / Productivity Apps and Services / Sharepoint / SharePoint 2013
Tip/Trick

Open infopath Form in SharePoint Modal Popup Window

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
5 Jul 2016CPOL 12.5K  
Let us discuss how to open InfoPath form in SharePoint modal popup window in SharePoint 2013

Introduction

Add the below code in your page to open infopath form in SharePoint modal popup window.

Add hyper link in the page:

HTML
<a href="#" class="infopathform"> Click here to open the form </a>

Open the page and add the below code in PlaceHolderAdditionalPageHead section.

JavaScript
$(document).on('click', '.  infopathform  ', function () {
    openMyDialog();
});

var InfoPathCheck;

function openMyDialog()  
{ 
  var options = { 
    url: "/_layouts/15/FormServer.aspx?XsnLocation="+_spPageContextInfo.webAbsoluteUrl +
    "/FormServerTemplates/BICCReportForm.xsn&SaveLocation="+_spPageContextInfo.webAbsoluteUrl +
    "%2FReport%20Request&ClientInstalled=false&DefaultItemOpen=1&Source="+
    _spPageContextInfo.webAbsoluteUrl+"%2FReport%2520Request%2FForms%2FAllItems%2Easpx", 
    title: "Request a New Report", 
    dialogReturnValueCallback: function (dialogResult)  
    {       
       if(dialogResult==1){
       
     SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', Alertoptions );
       } 
    }, 
    allowMaximize:false 
  }; 
 
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}

Either change URL in the code or copy the URL from your site by navigating to library and open the form. Copy the URL from browser and paste it in the code.

  • FormName - your infopath form name
  • LibraryName- where you published your infopath form
HTML
"/_layouts/15/FormServer.aspx?XsnLocation="+_spPageContextInfo.webAbsoluteUrl +
"/FormServerTemplates/FormName.xsn&SaveLocation="+
_spPageContextInfo.webAbsoluteUrl +
"%2FLibraryName&ClientInstalled=false&DefaultItemOpen=1&
Source="+_spPageContextInfo.webAbsoluteUrl+
"%2FLibraryName%2FForms%2FAllItems%2Easpx"

History

  • 5th July, 2016 - Initial version created

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
I am Senthil Gopal, a SharePoint Lead based out of Chennai, India.
I have around 9+ years of experience in Microsoft technologies such as C#,Asp.net, SharePoint 2010 and 2013.
This is a Social Group

4 members

Comments and Discussions

 
-- There are no messages in this forum --