Runtime ErrorMessage for Madatory fields in Infopath 2007 browser based forms - InfoPath Dev
in

InfoPath Dev

Runtime ErrorMessage for Madatory fields in Infopath 2007 browser based forms

Last post 05-12-2011 08:13 AM by Steph11. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-11-2011 09:14 AM

    • BMARU
    • Not Ranked
    • Joined on 03-25-2011
    • Posts 24

    Runtime ErrorMessage for Madatory fields in Infopath 2007 browser based forms

    I am working on infopath 2007 browser based form on which on selection of radio button I am adding the error message like below

    public void IsGuest_Validating(object sender, XmlValidatingEventArgs e)
            {
                // Write your code here to change the main data source.
                if (e.NewValue == "Yes")
                {
                    XPathNavigator Main = MainDataSource.CreateNavigator();
                    XPathNavigator Guestname = Main.SelectSingleNode("/my:myFields/my:Guest/my:GuestName", NamespaceManager);
                    this.Errors.Add(Guestname, "Guestname", "Guestname Cannot be null");
                }
                else
                {
                    checkErrors("Guestname");

                }
            }

     public void checkErrors(string ErrorName)
            {
                try
                {
                    this.Errors.Delete(ErrorName);
                }
                catch (Exception) { }
            }

    This function add the error messgae when Guest Selected and remove the error message when guest is not selected .I am using submit option through rule and submit to sharepoint library

    When use r submit, Problem is mandatory fields have value filled by user even it says (InfoPath cannot submit the form because it contains errors. Errors are marked with either a red asterisk (required fields) or a red, dashed border (invalid values).)

    I have tried with IsGuest_Changed event also.

    I am not getting why this error come even if user fill the values in mandatory fields.I am using couple of radio button for this type of validation in same form.

    Any help please let me know.

    Filed under:
  • 05-11-2011 09:56 AM In reply to

    Re: Runtime ErrorMessage for Madatory fields in Infopath 2007 browser based forms

    Can you check if all the mandatory fields in your Main Data Source are filled with values ? When you submit an InfoPath form, the entire data source must be free of validation errors for submit to happen.

  • 05-11-2011 01:59 PM In reply to

    • BMARU
    • Not Ranked
    • Joined on 03-25-2011
    • Posts 24

    Re: Runtime ErrorMessage for Madatory fields in Infopath 2007 browser based forms

    it seems like when radio button change event fire then its set mandatory fields and once user enter the values its disappear red madatory field but when user fire submit button then again its display red madatory field with user entered value.

  • 05-12-2011 08:13 AM In reply to

    Re: Runtime ErrorMessage for Madatory fields in Infopath 2007 browser based forms

    You can add a new button on your form and show the number of Errors from the Errors collection, because I think that you add the error to the Errors collection in the Validating or Changed event of that boolean node, so when you try to submit the form the error is still there so that's the reason you can't submit the form. You need to delete the error from the Erros collection before submitting the form - you could do this in the changed event for the GuestName text box.

     

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