Tuesday, April 10, 2012

Redirect Infopath Webpart to Custom URl after Submit the Form

This is the solution to recirect the Infopath webpart to custom URl, after submit the form.

Step1: Create a page and add Infopath Webpart.
Step2: Refer the Infopath Form in Infopath Webpart.
Step3: Add a content Editor Webpart to the Infopath webpart page and add below code.

script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"
/script

script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript"

/script

script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js" type="text/javascript"

/script

script type="text/javascript"
( function($)
{
// we can now rely on $ within the safety of our “bodyguard” function
$(document).ready(
function()
{
if($('#DialogFinalMessage').children().length>0)
{
window.location.href = "custom url";
}

}
);
} ) ( jQuery );

/script

No comments: