Save/Export form to a computer's folder using a button - InfoPath Dev
in

InfoPath Dev

Save/Export form to a computer's folder using a button

Last post 12-21-2009 02:38 PM by ACrush. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 12-17-2009 01:58 PM

    Save/Export form to a computer's folder using a button

    Hello,

    I am in urgent need of solving this. I have designed the form. I need to include a button in the form which when clicked would locally save the form to a predefined folder in PC. The filename of the form saved would be a field's data (field name is "filename" present in the form to be filled). The preferred format of saving the form would be .mht; however the usual infopath form is also acceptable if that is not possible. I did see some codes in some other threads but I do not exactly know how and where to place the code. Someone plz help this newbie step by step.  Basically, I need to use the form throughout the day, its really not possible to each time go clicking the export option from menu and type out the long file name. So a button option that does the function would be real fine. Awaiting your responses..Thanks in advance

  • 12-17-2009 09:33 PM In reply to

    Re: Save/Export form to a computer's folder using a button

    this.saveas("your path");

    should do the stuff for you

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 12-17-2009 11:17 PM In reply to

    Re: Save/Export form to a computer's folder using a button

    Hi,

    Thanks for your reply but where exactly should i paste the code into?....i know to have the button inserted. How do I set the button options and have your code entered there? and will this code help me save in mht format?

  • 12-18-2009 02:31 AM In reply to

    Re: Save/Export form to a computer's folder using a button

    drop a button on to the form, double click the form -> edit form code.

    write the code there.

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 12-18-2009 09:42 AM In reply to

    Re: Save/Export form to a computer's folder using a button

    hello,

     

    Tried the same ...exactly used the command as :

    // Do not modify the name of the function, or the name and number of arguments. //======= function CTRL22_5::OnClick(eventObj) { this.saveas("C:\Feedback\"); }

     

    but getting an error as:

    Unterminated string constant
    File:script.js
    Line:24
     this.saveas("C:\Feedback\");

    Note: As i told one of the entry in the form is the filename, will this command capture the data entered in filename and save it accordingly each time? If not what change must I do?

  • 12-21-2009 02:35 PM In reply to

    Re: Save/Export form to a computer's folder using a button

    Your path should contain the file name too. Say "C:\Feedback\"+node.Value+".xml". Just make sure you have the appropriate text value in the node and you know what you're doing when you overwrite existing files.
  • 12-21-2009 02:38 PM In reply to

    Re: Save/Export form to a computer's folder using a button

    by the way, make sure that you use the backslash correctly in strings. Some languages like C (js is genetically close, but I'm not sure) require it to be escaped: "C:\\Feedback\\"
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.