5/2/09

Redirect to other URL when closing an Infopath Form

When we have a web-browser enabled Infopath form you would have the need to redirect after close this form. In fact this possibility is enabled in the submit button, which redirects you to the original library where form is in. If you want to change this URl you must edit the form and copy the original URL. For example:

https://misharepoint/_layouts/FormServer.aspx
XsnLocation=/FormServerTemplates/nombreFormulario.xsn&
Source=https://misharepoint/Paginas/Default.aspx&DefaultItemOpen=1

You must change the URL of the 'Source' attibute and put the new URL:

https://misharepoint/_layouts/FormServer.aspx XsnLocation=/FormServerTemplates/nombreFormulario.xsn& Source=https://misharepoint/sitio/Paginas/prueba.aspx&DefaultItemOpen=1

&DefaultItemOpen=1 is very important. This attribute allows the form to be opened in a web browser.

CASE A:

One of the problem you can find is that this cheat only works in a same Site Collection.
If you want to put a foreign URL (like http://migueltabera.blogspot.com) you must create and ASPX file (
Redirection.aspx) in the path:

C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\TEMPLATE\LAYOUTS

and add this code:





After add this code you are enable to put this ASPX direction in the 'Source' attribute of the URL Form

https://misharepoint/_layouts/FormServer.aspx XsnLocation=/FormServerTemplates/nombreFormulario.xsn& Source=https://misharepoint/_layouts/redireccion.aspx&DefaultItemOpen=1


CASE B:

If the form is inside a frame you have to change the ASPX 'redirector' and put this javascript code:









Information extracted from the Miguel Tabera's Blog.

No hay comentarios: