Blog- SoHo Dragon

#DragonTalk

Click column

In the previous post I explained how to open an InfoPath form in the iframes of SharePoint.  This post will explain how to open an InfoPath form in an iframe of SharePoint.

Steps

Firstly there needs to be code in the column that will target a saved form

Create a column in a view:

=CONCATENATE("<DIV><a href='http://<servername>/<Site>/pages/EditInfopath.aspx?formname=/<Site>/Library/",Title,"'>",Title,"</a></DIV>")

EditinfoPage- To open up the infopath form with the query string:

<iframe src="" width=99% scrolling=no frameborder=0 marginwidth=0 marginheight=0 height=1000></iframe>

Add this in a content editor web part

<script>

<!--

function getArgs() {

var args = new Object();

var query = location.search.substring(1);

var pairs = query.split("&");

for(var i = 0; i < pairs.length; i++) {

var pos = pairs[i].indexOf('=');

if (pos == -1) continue;

var argname = pairs[i].substring(0,pos);

var value = pairs[i].substring(pos+1);

args[argname] = unescape(value);

}

return args;

}

var args = getArgs();

if (args.formname) formname = args.formname;

 

var sourceURL = "http://<servername>/<Site>/default.aspx";

 

var iframe = document.getElementById("MyFrame");

iframe.src = "'http://<servername>/<Site>/_layouts/FormServer.aspx?XmlLocation=" + formname + "&Source=" + sourceURL + "&DefaultItemOpen=1";

 

-->

</script>

Tags

see all