Submit Email Validation Via Code - InfoPath Dev
in

InfoPath Dev

Submit Email Validation Via Code

Last post 05-30-2008 08:06 AM by admot. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-29-2008 12:57 PM

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    Submit Email Validation Via Code

    I have a data connection to submit a form via email called "emailMySubmit". When I perform a "Submit To Email", I get a popup confirmation stating "The form was submitted successfully." I assume this means it performed a validaiton to ensure it was sent to Outlook.

    Since I want to close InfoPath after a submit, I placed in a "XDocument.View.Window.Close(true);" command which I got from a search from this site :).
    This means I need to "Custom submit using form code". The code I used is below since I cant use the "Submit To Email" and the OnSubmitRequest event at the same time.

     function XDocument::OnSubmitRequest(eventObj)
    {
      XDocument.DataAdapters["emailMySubmit"].Submit();
      XDocument.View.Window.Close(true);
    } 

    I noticed the popup confirmation did not appear when I used this approach. I assume this is because I am going through code.

    Question:
    1) Is there a way to perform a confirmation in code and indicate if it was a success or failure? I did a search on this site and google and I found some checking via a SharePoint website but not via email.
    2) Is the confirmation already done and it just doesn't provide a popup?

    Thanks,

    Don't grow old regretting the things you didn't do.
  • 05-29-2008 01:11 PM In reply to

    Re: Submit Email Validation Via Code

    Any reason why you are doing this in code rather than rules and actions.

    You can submit and close the form there too.

    You can use an .Alert("Done") in code to generate a message box if you want.

    I believe you would receive an error if there was a problem but not sure how you can provide a confirmation.

    Typically I always copy the form user on the submit email so that they have a "receipt" to verify the process. You could give them the option for this in the form too.

  • 05-30-2008 08:06 AM In reply to

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    Re: Submit Email Validation Via Code

    I would really like to do it via rules and actions. However, my goal is to close the form and the application. From what I understand, this can only be accomplished via code. I noticed when I ran the "Submit to: Email", the OnSubmitRequest(eventObj) did not fire. Therefore, it seems to be [Use rules but can't close app] vs [Use code and close app].

    Guess I need a better understanding of the "Submit to: Email" confirmation of success/fail as its kind of confusing. In my code in the previous post, I get an error message when I click submit then cancel. The error message says "The form was not submitted because the action was cancelled." but then my custom failure message I setup in the rules appears. But when I use rules/actions to submit, my custom failure message doesn't appear when I hit submit then cancel.

     Right now, I would like to at least get it to a point where it doesn't produce an error flag if I click submit then cancel. Suggestions?

     

    BTW: CC'ing the sender as a "receipt" is a good idea for a confirmation. I can also just provide a popup to check their send box to confirm it was send (if they keep their send emails).

    Don't grow old regretting the things you didn't do.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.