Display Validation Error Summary in InfoPath 2013 - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Display Validation Error Summary in InfoPath 2013

Last post 01-15-2018 07:51 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-12-2018 08:52 AM

    Display Validation Error Summary in InfoPath 2013

    I'm trying to use "Check for Errors" button with code behind to display validation errors in InfoPath 2013. This code below worked in the previous versions. Does anyone know how to apply this code to work in InfoPath 2013 or newer using C#? function CTRL348_5::OnClick(eventObj) { // Write your code here var error; error = XDocument.Errors.Count; if(error != 0) XDocument.UI.Alert("You have not filled in all of the required fields or have invalid data/incorrect format!\n\n\t\tNumber of fields with errors: " + XDocument.Errors.Count + "\n\n[ HINT: to jump to the field with errors, after clicking on OK, press CTRL+SHIFT+O ]"); if(error == 0) XDocument.DOM.selectSingleNode("/my:myFields/my:frmError").text = "enabled"; }
  • 01-12-2018 09:49 AM In reply to

    Re: Display Validation Error Summary in InfoPath 2013

  • 01-13-2018 03:18 AM In reply to

    Re: Display Validation Error Summary in InfoPath 2013

    Hi Hilary, What do you think about this code below: public void CTRL2_5_Clicked(object sender, ClickedEventArgs e) { // Write your code here. FormErrorCollection myFormErrors = Errors; XPathNavigator mytxtbox = MainDataSource.CreateNavigator(); mytxtbox = mytxtbox.SelectSingleNode("/my:myFields/my:frmError", NamespaceManager); int formErrors = Errors.Count; if (formErrors > 0) mytxtbox.SetValue("disabled"); else mytxtbox.SetValue("enabled"); { MessageBox.Show("Number of errors: " + Errors.Count); string errors = string.Empty; foreach (FormError err in Errors) { errors += "" + err.Message + System.Environment.NewLine; } MessageBox.Show("Fill out required fields: " + System.Environment.NewLine + errors + System.Environment.NewLine + "Hint: Press Ctrl+Shift+O"); } } Thanks, Earl
  • 01-15-2018 07:51 AM In reply to

    Re: Display Validation Error Summary in InfoPath 2013

     Is this working for you? If so, I think its fine. :)

    Hilary Stoupa

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