submit button programming - InfoPath Dev
in

InfoPath Dev

submit button programming

Last post 05-02-2010 12:48 AM by g_v_jain. 16 replies.
Page 1 of 2 (17 items) 1 2 Next >
Sort Posts: Previous Next
  • 04-23-2010 09:13 PM

    submit button programming

    Need help with programming the custom button control.

    i want that when the button is clicked,

    - the completed form is saved to a location on my computer in pdf with a field name as the file name

    - the form is also printed to the default printer, on A4 size, and 2 copies

    Filed under:
  • 04-26-2010 03:59 AM In reply to

    Re: submit button programming

    to print two copies. just call twice

    this.Print();

    to  save file to your local system

    this.CurrentView.Export("file path and name", ExportFormat.Pdf);

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-26-2010 06:00 AM In reply to

    Re: submit button programming

    Thanks a lot Anis.

    I am a medico legal professional and am working on a template for autopsy report. So I am less than even a novice at this.

    So if u dont mind, just guide me where to insert the code that u have suggested. Below is the last line of the page I get when I click on the EDIT FORM CODE button of the properties of the custom button.

    _function CTRL345_5::OnClick(eventObj) { // Write your code here }_

    Also Cud u help me that how can I adjust the export code so that it names the file with the autopsy number as default.

    Thanks a lot again.

  • 04-26-2010 06:12 AM In reply to

    Re: submit button programming

    can you attach the form template so that i can have a look at you, and tell you what eactly to do,

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-26-2010 07:52 AM In reply to

    the file is attached. did it the way i understood.

    tell me if some other way of attaching the file.

  • 04-26-2010 11:06 PM In reply to

    Re: submit button programming

    the below code is in c#;

    if your template doesnt have any other code, just remove the previous code (go to tools -> form options -> programming -> click remove code)

    after that change the form template code language to c#;

    and insert the below code at proper places 

    public void CTRL4_5_Clicked(object sender, ClickedEventArgs e)

    {

    //for printing the form. If you need two copies just write the statement once again

    this.Print();

    }

    public void CTRL3_5_Clicked(object sender, ClickedEventArgs e)

    {

    // saving to location in pdf format

    string autopsy_no = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:autopsy_no.", this.NamespaceManager).Value;

    string save_location = "C:\\new folder\\"+autopsy_no+".pdf";

    this.CurrentView.Export(save_location, ExportFormat.Pdf);

    }

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-26-2010 11:24 PM In reply to

    Re: submit button programming

    Thanks a lot again I'll give it the shot and let u know the outcome. u have been a great help
  • 04-26-2010 11:26 PM In reply to

    attached is your template and code behind. you will need to specify the path of your new code. unzip g_v_.._fix.zip save it to some location. then open the template go to tools -> form options -> browse and browse to the folder where you saved the unzipped attachment. and point to the sln file in there.

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-27-2010 12:46 AM In reply to

    Sorry for posting the attachments on two posts. i had initially forgot to post both the attachments and later i could find option to attach the second one also.

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-27-2010 02:21 AM In reply to

    Re: submit button programming

    Thanks a lot
  • 04-27-2010 06:50 AM In reply to

    Re: submit button programming

    Hi Anis

    Its me again

    Cant enable C#

    dont have visual studio or vsta

    can u help me with a code in Jscript/ VB script

    Sorry, computer languages are just black alphabets for me

  • 04-28-2010 02:27 AM In reply to

    Re: submit button programming

    check this to check how you can install VSTA on your machine. VSTA is shipped with office installations.

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 04-28-2010 02:40 AM In reply to

    • Prasad
    • Not Ranked
    • Joined on 04-29-2009
    • Hyderabad
    • Posts 19

    Re: submit button programming

     

    Regards,
    P V V S V Prasad
    Invesco
    MyBolg
  • 04-28-2010 10:06 AM In reply to

    Thanks for all the time and efforts, Anis.

    I have been able to change the form language to C#, and entered the code as u said.

    But clicking the button is not saving the file as intended.

    Template is attached.

  • 04-28-2010 10:07 AM In reply to

    Re: submit button programming

    Hi Prasad,

    Guess I am missing something, or is the box actually empty.

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