cancelling code submit not working - InfoPath Dev
in

InfoPath Dev

cancelling code submit not working

Last post 10-02-2009 08:01 PM by Qazi Anis. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-02-2009 07:00 AM

    cancelling code submit not working

    Hi,

    I have a InfoPath 2007 form which is published as a web form in SharePoint.  It is submitted programatically using custom code.  This works fine, except in the case that there are validation error with the form.  If there are errors, the following message is shown:

     An error occurred while the form was being submitted.
    The submit event handler returned a value indicating that the submit failed.

     In my submit handler I have the followig:

    if (this.Errors.Count == 0)
    {

     //do submit here

    e.CancelableArgs.Cancel = false

    }
    else
    {

    e.CancelableArgs.Cancel = true;

    }

    Setting e.CancelableArgs.Cancel = true seems not to be stopping forms services from attempting to submit the form, and so the error is shown.

    Has anyone got an idea on how to ensure the form is valid before it is submitted, or cancel submission in a submit handler properly?

    Thanks,

    Craig

  • 10-02-2009 08:01 PM In reply to

    Re: cancelling code submit not working

    you might consider submitting the form on a normal buttton instead of a submit button, in that case you dont need to set the cancelableargs. drawback of this is that you will have to use a label(textbox) to give the status to the user.

     

    Qazi Anis
    Technical Architect
    Bitwise Inc
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.