btnSubmit_Clicked with both Rules and Code Behind - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

btnSubmit_Clicked with both Rules and Code Behind

Last post 05-30-2012 12:02 PM by SeanPRyan. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 05-29-2012 10:52 AM

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 59

    btnSubmit_Clicked with both Rules and Code Behind

    Can you fire off multiple rules and also put code into the code behind in VSTA? I have 3 rules associated with a given button as it relates to fields on my form.  

    MakeTrue (sets a fields value), SubmitMe (Submit using Data Connection) and CloseOutForm (Close No Prompt).  CloseOutForm doesn't Stop Processing Rules. 

    I then have a breakpoint set on:  public void btnSubmit_Clicked(object sender, ClickedEventArgs e) in the C# code behind.  It never fires.  If I create a generic button, and associate the code with it and no rules, it works fine.

     Any tips are most appreciated. 

    Sean
  • 05-29-2012 11:13 AM In reply to

    Re: btnSubmit_Clicked with both Rules and Code Behind

    Rules run before code - so your rule that closes the form will execute prior to the code running. You probably need to close your form in your code on the button instead.

    Hilary Stoupa

  • 05-29-2012 12:03 PM In reply to

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 59

    Re: btnSubmit_Clicked with both Rules and Code Behind

     Thanks for the response.  I will try that. 

    Sean
    Filed under:
  • 05-29-2012 12:23 PM In reply to

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 59

    Re: btnSubmit_Clicked with both Rules and Code Behind

     I couldn't find a method to close the form.  This is a browser enabled form.

    Sean
    Filed under:
  • 05-29-2012 12:57 PM In reply to

    Re: btnSubmit_Clicked with both Rules and Code Behind

    I didn't realize it was a browser form - I see some asst'd posts and code snippets online for closing a browser based form - but it may be simpler to just have your code set a field that has the rule on it to close the form... Then, when the code is complete, it sets a field's value, that field has the close rule - does that make sense?

    Hilary Stoupa

  • 05-29-2012 01:01 PM In reply to

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 59

    Re: btnSubmit_Clicked with both Rules and Code Behind

     Yes, that does make sense.  I will respond back when I have things working.  Thanks again for taking the time :-)

    Sean
    Filed under:
  • 05-30-2012 10:48 AM In reply to

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 59

    Re: btnSubmit_Clicked with both Rules and Code Behind

     I was unable to make this work in any way at all.  There must be a way to accomplish this.  I did set a value of a field and then in the rules, close form is not an option. It only appears as an option for buttons.  The Close this form after submit is not working either.  I have this form showing within XMLFormView so perhaps some JavaScript could work, but I've yet to make it work.  Any other clues for me?  Thanks.

    Sean
    Filed under:
  • 05-30-2012 10:53 AM In reply to

    Re: btnSubmit_Clicked with both Rules and Code Behind

    Try this blog post? Although - it does sound as if the author is having a different experience than you are....

    Hilary Stoupa

  • 05-30-2012 12:02 PM In reply to

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 59

    Re: btnSubmit_Clicked with both Rules and Code Behind

    I went through that page in detail earlier.  It was very close. But I did arrive at a solution finally.  Sometimes I over think it.

    I created a new section in my Infopath Form and called it WholePage.  I then copied the entire form into this section. Then I created a new section and called it ThanksSection.  I entered some text saying thanks for filling out the form and placed a button with a rule to close the form. This section is not visible initially via Conditional Formatting.

    The Whole section is then hidden when a user submits (again with Conditional Formatting) and the Thanks Section becomes visible.  All of my emails are fired off and the user can then click the button to close the form.  I guess the real key is to really examine your design before setting to task too quickly.

    Thanks so much for your help.

     Sean

    Sean
    Filed under: , ,
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.