Default Save Location - InfoPath Dev
in

InfoPath Dev

Default Save Location

Last post 11-04-2008 03:44 PM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-31-2008 04:09 PM

    • dfxdeimos
    • Not Ranked
    • Joined on 10-31-2008
    • Seattle, WA
    • Posts 4

    Default Save Location

    Hello all.

    I did a search before posting this and saw several topics that were related, however in all of them the poster shifted the topic from saving to submitting and I wanted to get a concrete answer.

    Can you set a default save location either in InfoPath or in a specific form WITHOUT using a submit button?

    A "no" is fine, but to be clear I am not looking for answers that suggest using a submit button.

    Thank you.

  • 11-02-2008 03:59 PM In reply to

    Hey there.

     

    To qualify a "submit" to SharePoint for instance is the same as a save.  The XML document is saved to a Form Library.

    Best practice is to use a submit since then you can control where and how it is named rather than depending on the user to do this right or to take the time.

    If you use the toolbar they can both be a button.

    Otherwise have a button in your form and label it save.

    You can use code to set a save location and name but this increases the complexity and may cause trust issues.

    Why are you worried about submit vs. save?

  • 11-03-2008 09:36 AM In reply to

    • dfxdeimos
    • Not Ranked
    • Joined on 10-31-2008
    • Seattle, WA
    • Posts 4

    As mentioned in my post I am not interested in solutions that use a "Submit" function.

    I just need to know if this is possible to do with a "Save" function.

    Thank you.

  • 11-03-2008 01:40 PM In reply to

    • dfxdeimos
    • Not Ranked
    • Joined on 10-31-2008
    • Seattle, WA
    • Posts 4

    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;
     
    }
  • 11-04-2008 01:57 PM In reply to

    • dfxdeimos
    • Not Ranked
    • Joined on 10-31-2008
    • Seattle, WA
    • Posts 4

    Anyone have any ideas?

  • 11-04-2008 03:44 PM In reply to

    Actually, I got this to work, using your code on a blank form. I had to be sure that the URL pointed to the library I wanted to save in, so http://server/site/library worked, but http://server/site/library/forms/allitems.aspx did not. Experiment with the URL you are using as a path in the SetSaveAsDialogLocation method.... oh, and I saved to a regular document library, not a form library.....

    Hilary Stoupa

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