<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>InfoPath 2003 opening and managing multiple forms using jscript</title><link>https://www.infopathdev.com:443/forums/thread/74490.aspx</link><pubDate>Tue, 24 Jan 2012 17:35:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:74490</guid><dc:creator>TerryB</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/74490.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=74490</wfw:commentRss><description>&lt;p&gt;Hi, I&amp;#39;m trying to open a newformsolution form and then add values to it then save and quit it. I currently have the following code but I&amp;#39;m struggling (because of my skills) to save the newform solution - can anyone help please.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;//&lt;br /&gt;&amp;nbsp;var fred = Application.XDocuments.NewFromSolution(&amp;quot;&lt;a&gt;\\\\specialportal\\sites\\def\\abc_Questionnaire5B&lt;/a&gt; Pilot\\Forms\\template.xsn&amp;quot;);&lt;br /&gt;&amp;nbsp;// set Newformsolution DOM&amp;nbsp;&lt;br /&gt;&amp;nbsp;var MyFormDOM = fred.DOM;&lt;br /&gt;&amp;nbsp;MyFormDOM.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;xmlns:my=\&amp;quot;&lt;a href="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-20T15:52:17/"&gt;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-20T15:52:17\&lt;/a&gt;&amp;quot;&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;// Copy the values from the current form to the new form&lt;br /&gt;&amp;nbsp;MyFormDOM.selectSingleNode(&amp;quot;//my:ProjectType&amp;quot;).text = aNode.selectSingleNode(&amp;quot;./my:ProjectType&amp;quot;).text;&lt;br /&gt;&amp;nbsp;MyFormDOM.selectSingleNode(&amp;quot;//my:ProjectRef&amp;quot;).text = aNode.selectSingleNode(&amp;quot;./my:ProjectRef&amp;quot;).text;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;/*&lt;br /&gt;&amp;nbsp;for (i=0; i &amp;lt; Application.XDocuments.Count; i++)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;XDocument.UI.Alert(&amp;quot;XDocument URI: &amp;quot; + Application.XDocuments(i).URI + &amp;quot; Number =&amp;quot; + i);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;*/&lt;br /&gt;&amp;nbsp;// &lt;strong&gt;From here I want to be able to save and quit the newformsolution but I don&amp;#39;t understand how to!!&lt;br /&gt;&lt;/strong&gt;&amp;nbsp;// var dataOBJ = XDocument.DataAdapters(1);&lt;br /&gt;&amp;nbsp;try&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;//dataOBJ(&amp;quot;Submit&amp;quot;).Submit(); - this doesn&amp;#39;t work&lt;br /&gt;&amp;nbsp;&amp;nbsp;XDocument.DataAdapters(&amp;quot;Submit&amp;quot;).Submit();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // this saves the already open form rather than the newformsolution form.&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;catch (e)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;XDocument.UI.Alert(e.message);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;XDocument.UI.Alert(&amp;quot;form submitted now going on to close.....&amp;quot;);&amp;nbsp;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;// Close the newformsolution questionnaire - which I think the next 2 lines do&lt;br /&gt;&amp;nbsp;var objXDoc = Application.XDocuments(1);&lt;br /&gt;&amp;nbsp;Application.XDocuments.Close(objXDoc);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;XDocument.UI.Alert(&amp;quot;On hold after submit &amp;amp; close.....&amp;quot;);&lt;/p&gt;</description></item></channel></rss>