in

InfoPath Dev

Summary of Validation Errors

Last post 10-23-2008 10:37 AM by Bhavesh. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-21-2008 09:22 AM

    • AlexSt
    • Not Ranked
    • Joined on 07-22-2008
    • Posts 1

    Summary of Validation Errors

    Hi,

    I am trying to get a complete List of all validation Errors in a browser enabled form. In my environment, the XmlFormView is embedded into an aspx page and  would like to get the errors after calling XmlForm.Submit(). I looked into the XmlForm.Errors but it seems that this Property is not accessible within browser enabled forms. If I catch the exception that is thrown by XmlForm.Submit() when there are validation errors on the page, I am only able to get the first error that occured during validation.

    Searching the internet I found some hints, that it might be possible to access all validation errors using code within the InfoPath forms. Since this requires the forms to be approved by an administrator I am looking for a solution that avoids integrated code.

    Does anyone have any ideas how to achieve this, or am I completely on the wrong track?

    Thanks

    Alex 

  • 10-23-2008 10:37 AM In reply to

    • Bhavesh
    • Top 150 Contributor
      Male
    • Joined on 05-01-2008
    • Atlanta
    • Posts 33

    Re: Summary of Validation Errors

    Hi,

    For checking the InfoPath form's error collection getting populated with validation errors you need to write some VSTA code and then you can check the error collection for getting the details of all the errors. Without writing a code i do not think we have any way to check the error collection.

    you can try the following code

    int FormErrcount = 0;

    FormErrcount = Errors.Count;

    if (FormErrcount > 0)

    {

    foreach (FormError err in Errors)

    {

    ErrorDesc += "(" + err.FormErrorType + ", " + err.Site.Name + ") " + err.Message + System.Environment.NewLine;

    if (err.Site.Name == "my:field1")

    {

    (...do some operation)

    return false;

    }

     

    Bhavesh

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