I think I may be on the right path, but I am still having some issues. Somone helped me write the following custom save code, but when I try to save the form it still defaults to the user's Documents. Can anyone see a problem with the code below?
/*
* This file contains functions for data validation and form-level events.
* Because the functions are referenced in the form definition (.xsf) file,
* it is recommended that you do not modify the name of the function,
* or the name and number of arguments.
*
*/
// The following line is created by Microsoft Office InfoPath to define the prefixes
// for all the known namespaces in the main XML data file.
// Any modification to the form template files made outside of InfoPath
// will not be automatically updated.
//<namespacesDefinition>
XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://contoso.com/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-04T16:19:23" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"');
//</namespacesDefinition>
//=======
// The following function handler is created by Microsoft Office InfoPath.
// Do not modify the name of the function, or the name and number of arguments.
//=======
function XDocument::OnLoad(eventObj)
{
try
{
var CreateAccountData = XDocument.DataObjects["CreateAccount"];
var CreateAccountAdapter = CreateAccountData.QueryAdapter;
CreateAccountAdapter.Timeout = 120;
}
catch(e)
{
// Do nothing currently.
}
}
//=======
// Die folgende Handlerfunktion wurde von Microsoft Office InfoPath erstellt.
// Der Funktionsname und die Anzahl und Namen der Argumente dürfen nicht geändert werden.
//=======
function XDocument::OnSaveRequest(eventObj)
{
// Erstellen Sie hier den Code, der vor dem Speichern ausgeführt werden soll.
//Set Save As location
XDocument.UI.SetSaveAsDialogLocation("http://intranet.mycompany.com/Departments/Personel/Forms/FormLibrary/");
//Perform SAVE function
eventObj.IsCancelled = eventObj.PerformSaveOperation();
// Erstellen Sie hier den Code, der nach dem Speichern ausgeführt werden soll.
eventObj.ReturnStatus = true;
}