Kwizcom Forms

InfoPath 2013 Navigate to NewForm page on button click from EditForm page using JavaScript or jQuery

navigate from NewForm.aspx page to EditForm.aspx page with query string parameter from a button click using JavaScript and jQuery in SharePoint

This SharePoint tutorial explains, how to navigate from NewForm.aspx page to EditForm.aspx page with query string parameter from a button click using JavaScript and jQuery in SharePoint.

InfoPath Designer 2013: Navigate to NewForm page on button click from EditForm page using JavaScript or jQuery

Here the SharePoint list form is customized using InfoPath designer 2013. Here in my Edit form page, there is a button and my requirement is on click of that button New form should open and it should take the ID as a query string parameter.

SharePoint deveopment training course

Edit the Edit form page and then add a script editor web part and insert the below code in the script editor web part.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<SCRIPT type=text/javascript>
var itemId =";
jQuery(document).ready(function() {
JSRequest.EnsureSetup();
itemId = JSRequest.QueryString[“ID"];

});

function test()
{

var button = document.getElementById('ctl00_ctl39_g_377139d0_8e3d_4bd2_b076_5fe8f9fae83b_FormControl0_V1_I1_B5');

document.getElementById('ctl00_ctl39_g_377139d0_8e3d_4bd2_b076_5fe8f9fae83b_FormControl0_V1_I1_T1').value=itemId;

if(button.addEventListener)
{
button.addEventListener(“click", function() {
window.open(“https://SiteURL/Lists/Test2/Item/newifs.aspx?ParentItemID="+document.getElementById('ctl00_ctl39_g_377139d0_8e3d_4bd2_b076_5fe8f9fae83b_FormControl0_V1_I1_T1').value);

} );

}
}

window.onload =test;

</script>

You may like following SharePoint InfoPath tutorials:

Hope this SharePoint helps to learn how to navigate to NewForm page on button click from EditForm page using JavaScript or jQuery in SharePoint.

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 →