Handling OnSubmitRequest() failure message - InfoPath Dev
in

InfoPath Dev

Handling OnSubmitRequest() failure message

Last post 05-24-2006 11:18 PM by DavidCrabbe. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-25-2005 01:47 AM

    Handling OnSubmitRequest() failure message

    I've written an OnSubmitRequest() function to check if data for all the required fields has been supplied. Within the function I've called MessageBox to display an error if the validation fails.

    However I still receive the standard message: "InfoPath cannot submit the form. The onSubmitRequest event handler returned a value indicating that the submit failed."

    Is there any way in which I can prevent this message from being displayed?

    Thanks,
    David.
  • 10-25-2005 05:48 PM In reply to

    Re: Handling OnSubmitRequest() failure message

    Hi David,

    Tools / Submitting Forms
    Click on Submit Options...
    Uncheck "Show message indicating success or failure"

    Regards,

    Franck Dauché
  • 10-25-2005 06:07 PM In reply to

    Re: Handling OnSubmitRequest() failure message

    D'oh!

    Thanks, Franck. I had a nagging doubt the answer was obvious. :)
  • 10-25-2005 06:49 PM In reply to

    Re: Handling OnSubmitRequest() failure message

    You are welcome.

    Franck
  • 04-24-2006 07:43 AM In reply to

    Re: Handling OnSubmitRequest() failure message

    David:

    Would you be willing to share your code with me? I need to:

    1) On clicking the Submit button, through code, check to confirm all required fields have been entered and if not, display a message box, then leave the user in the form. If they have, the form is then submitted (Sharepoint list) and InfoPath is closed. I have the close code as Application.ActiveWindow.Close(true);

    THanks!
  • 05-24-2006 11:18 PM In reply to

    Re: Handling OnSubmitRequest() failure message

    Hi Deb,

    I wrote some custom validation for my form in addition to the standard validation offered by the Data Validation options on each control.

    The following code is contained within a button control's OnClick method:

    // Submit the form.
    try
    {
    // ...validate the form according to any custom criteria
    if( true == ValidateForm() )
    {
    // Attempt to submit the form...
    thisXDocument.Submit();

    // Provide feedback that the form has been submitted successfully...
    MessageBox.Show( "Form submitted successfully.", "Form Submission" );

    try
    {
    // ...and close the InfoPath application
    thisApplication.ActiveWindow.Activate();
    thisApplication.ActiveWindow.Close( true );
    }
    catch
    {
    // ...problem with closing the application
    ...

    There is also a means by which you can check programatically for the standard errors on the form (mandatory fields etc.), I think its an Error property on the document or something however I can't recall exactly, sorry.

    David.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.