"Save Action" in a button. - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

"Save Action" in a button.

Last post 07-14-2012 09:45 PM by Gennady Vanin (Геннадий Ванин, Новосибирск). 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 10-26-2009 12:34 PM

    "Save Action" in a button.

    Good afternoon,

    I currently building a role-based form in sharepoint.  It involves one person creating a request, and then a salesperson acting on the request.

    The first part is easy... the form initator saves the form to a document library, I have sharepoint workflows that notify the salesperson to look at the form. The salesperson opens the form, makes changes and this is where i'm stuck.

    Right now I have an button that closes the form and prompts the user to Save.  I would like to know if it's possible to not prompt the user and just save the form.  I'm afraid that some salespeople are going to click "no" and it'll stop the workflows I have setup to run from the salesman's changes.

    Thoughts?

    Do i have any options outside of adding code or submitting the file using the same name?  I'd rather not do the latter, because it would require me to redo my workflow triggers / naming convention for submitted forms. (i'm using the Now() function as part of the file name.)

    Thanks in advance.

  • 10-26-2009 10:31 PM In reply to

    Re: "Save Action" in a button.

    Hi TiltnSpill,

    As far as i know, infopath does not provide any such functionality to save the form on a button click. you can give users a toolbar on which you can give save functionality. to do so goto tools->form options and check the save checkbox. now save will be listed on the tool bar at the top of the form.

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 10-27-2009 05:47 AM In reply to

    Re: "Save Action" in a button.

    That's for the reply Qazi,

    I did know about the save button on the form toolbar.  I was just hoping I could autosave to I don't have step that could result in end-user error. But i'll leave that part up to the trainers :)

     

     

  • 11-12-2009 05:39 AM In reply to

    Re: "Save Action" in a button.

    May be late, but please have a look at my blog post

    http://blueinfopath.wordpress.com/2009/11/12/how-to-add-save-action-to-a-button-no-code/

    The fact is no action 'Save As' exists to use with rules, but using the rules Close Form works the same way.
    To test it you need not to use 'Preview' button in the dessigner, but save the InfoPath Template and open it.

    Everything is explained in the blog post

    Frederik Van Lierde
    Blue InfoPath Blog  ¦  SilverSands Associate  ¦  Do you follow me already?  ¦  We work smart, not hard


    If this article was helpfull, don't forget to rate it, tnx!
  • 11-12-2009 06:21 AM In reply to

    Re: "Save Action" in a button.

    Thanks for replying Frederik,

    Currently I have my forms setup like you have explained in your blog post. (to prompt the user to save on close.)

    I was hoping I had overlooked something and there was a way I could auto-save on close without the prompt! (just one less hoop for the end-user)

  • 01-30-2010 06:34 AM In reply to

    Re: "Save Action" in a button.

    Hi TiltnSpill

    Have you been able to save without propmpting the user using rules?

    I need to do the same.

    Next week I'll be trying to do it using custome code, since I've not been able to do it using rules.

    Best regards.

     

    Diego
  • 01-31-2010 09:13 PM In reply to

    Re: "Save Action" in a button.

    Doing it using custom code is easy it is just

    this.save();

    as far as closing the form goes, the prompt to user funtionality is not available in broswer enabled forms.

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

    Re: "Save Action" in a button.

    Hi, Qazi Anis....

    Just a note...I used this.save(); on the button that has all the rules ending with the close rule and it didn't work, then I realized that rules are executed before custom code  and the form closes before geting to the this.save();

    In my case the user had only one text field to modify so I placed the this.save() on the changed event of that field and all is ok.

     

    Diego
  • 02-01-2010 06:45 AM In reply to

    Re: "Save Action" in a button.

    Saving on changed event might not be a good idea, because what if the user wants to undo his actions or doesnt even want to change any data. you can move all your rules into the saving event for closing the form

    this.close

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 02-01-2010 07:01 AM In reply to

    Re: "Save Action" in a button.

    You are right Qazi Anis, if the user does change something but don't want to save it, he won't even know that it has already been saved.

    The problem I saw with this.close is that since I'm using infopath, and not form services, the form gets closed but infopath remains open. I really didn't like that behaivour.

    I guess closing the application should not be difficult either, but I haven't found the way to do it yet. (yes....you got it....I'm a newbie to infopath)

    Thanks for the advice....

    best regards.

     

    Diego
  • 02-01-2010 11:16 PM In reply to

    Re: "Save Action" in a button.

    for closing the application

    this.Application.ActiveWindow.Close();

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 02-02-2010 11:59 AM In reply to

    Re: "Save Action" in a button.

    I knew it was not that difficult and it's even easier with very helpful and kind people such as you.

    Now my form executes the rules and then it saves and closes using the custom code.

    Thanks Qazi Anis,

    Best regards

    Diego

    Diego
  • 07-06-2012 02:19 AM In reply to

    Re: "Save Action" in a button.

    How does one to this? When I add "this.save()" to the ClickedEventArgs of my button it tells me that "this" is not declared. I'm missing something. Also when you say to move the rules to the form close event, how does one do that.
  • 07-10-2012 04:00 PM In reply to

    Re: "Save Action" in a button.

    joeyjackson:
    Also when you say to move the rules to the form close event, how does one do that

    If you have not created those rules, what I incur is yr case from your question, then you have nothing to move.

    joeyjackson:
    How does one to this?

    When I add "this.save()" to the ClickedEventArgs of my button it tells me that "this" is not declared.  I'm missing something.

    First, it is not "this.save()" but "this.Save();" and it is in C# (note capital "S" and ";" at the end)
    You should use IntelliSense in VSTA

    Second, it is not argument but call of a method to be placed in the body of event handling method.
    I would again insist again your manual copy-pasting but instead generating the VSTA code by GUI using

    3d. if you have not changed your Programming Language then it will be Visual Basic.NET and you should have written "Me.Save()"

    4th, it is, obviously, available only in Infopath Filler forms

    Though, I cannot manage to succeed with this in Infopath 2010 getting:

     InfoPath cannot save the form.
    The form does not have a file name.
       at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocument.Save()
       at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentWrapper.Save()
       at Microsoft.Office.InfoPath.Internal.XmlFormHost.Save()
       at Microsoft.Office.InfoPath.XmlFormHostItem.Save()
       at CS_client.FormCode.CTRL1_5_Clicked(Object sender, ClickedEventArgs e)
       at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

     

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 07-14-2012 09:45 PM In reply to

    Re: "Save Action" in a button.

    Gennady Vanin (Геннадий Ванин, Новосибирск):
    Though, I cannot manage to succeed with this in Infopath 2010 getting:
     

    Any idea?

    From one side people write about its use, from another I asked it in social.technet.microsoft.com forum 

    and...

    Has somebody ever used "this.Save();"?
    in which version(s), context(s), how?

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
Page 1 of 1 (15 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.