How to Modifying validation Error Message - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

How to Modifying validation Error Message

Last post 01-18-2012 07:06 AM by Jo-Anne Alfafara. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-18-2012 06:00 AM

    How to Modifying validation Error Message

     

    I am using the validation of "Cannot be blank" and nothing else in all my fields. So when the user submits the form without completing the mandatory fields an error message pops up which says " InfoPath cannot submit the form because it contains validation errors.... "
    How can we change this long error message with a smaller one.

    Thank you!

    Snow
  • 01-18-2012 06:55 AM In reply to

    • bobga
    • Not Ranked
    • Joined on 12-22-2010
    • Posts 9

    Re: How to Modifying validation Error Message

    You need to do it using code behind the submit button.  Below is what I did in jscript.  Changing it to C+ should be easy. 

     

    function CTRL21_7::OnClick(eventObj)
    {
        var error_message = ""
      try
      { 
       
       XDocument.Submit();
      }
       
      catch (ex)
      {
       error_message = ex.message
       
       if ( ex.message.indexOf("does not contain any new data") > 0 )
        {
        XDocument.UI.Alert("Record not updated. No data has been changed.");
        }
       else
       if ( ex.message.indexOf("validation errors") > 0 )
        {
        XDocument.UI.Alert("Record not updated. There are validation errors. Errors are marked with either a red asterisk (required fields) or a red, dashed border (invalid values.");
        }
       else
       if ( ex.message.indexOf("permission denied") > 0 )
        {
        XDocument.UI.Alert("Record not updated. You do not have permission to add, delete, or update records.");
        } 
       else
       if (ex.message != "")
        {
        bracket = ex.message.indexOf("[")
        other_error = "Notify system administrator of critical error. " + ex.message.substr(bracket,500)
        XDocument.UI.Alert (other_error);
        }
       else
       if (ex.message == "")
        {
        XDocument.UI.Alert ("Draft saved successfully")
        }
      }
    }

  • 01-18-2012 07:06 AM In reply to

    Re: How to Modifying validation Error Message

    If you're not into coding, you can add conditional formatting to disable the submit button if required fields are blank, thus forcing the users to continue filling out the form.

    Jo-Anne Alfafara
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.