InfoPath 2003 opening and managing multiple forms using jscript - InfoPath Dev
in

InfoPath Dev

InfoPath 2003 opening and managing multiple forms using jscript

Last post 01-24-2012 09:35 AM by TerryB. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 01-24-2012 09:35 AM

    InfoPath 2003 opening and managing multiple forms using jscript

    Hi, I'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'm struggling (because of my skills) to save the newform solution - can anyone help please.

     //
     var fred = Application.XDocuments.NewFromSolution("\\\\specialportal\\sites\\def\\abc_Questionnaire5B Pilot\\Forms\\template.xsn");
     // set Newformsolution DOM 
     var MyFormDOM = fred.DOM;
     MyFormDOM.setProperty("SelectionNamespaces", "xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-01-20T15:52:17\"");

     // Copy the values from the current form to the new form
     MyFormDOM.selectSingleNode("//my:ProjectType").text = aNode.selectSingleNode("./my:ProjectType").text;
     MyFormDOM.selectSingleNode("//my:ProjectRef").text = aNode.selectSingleNode("./my:ProjectRef").text;
     
     /*
     for (i=0; i < Application.XDocuments.Count; i++)
     {
      XDocument.UI.Alert("XDocument URI: " + Application.XDocuments(i).URI + " Number =" + i);
     }
     */
     // From here I want to be able to save and quit the newformsolution but I don't understand how to!!
     // var dataOBJ = XDocument.DataAdapters(1);
     try
     {
      //dataOBJ("Submit").Submit(); - this doesn't work
      XDocument.DataAdapters("Submit").Submit();        // this saves the already open form rather than the newformsolution form.
     }
     catch (e)
     {
      XDocument.UI.Alert(e.message);
     }
     XDocument.UI.Alert("form submitted now going on to close....."); 
     
     // Close the newformsolution questionnaire - which I think the next 2 lines do
     var objXDoc = Application.XDocuments(1);
     Application.XDocuments.Close(objXDoc);
     
     XDocument.UI.Alert("On hold after submit & close.....");

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.