none
Infopath 2013 use rules to display validation error

    Question

  • In a new InfoPath 2013 form, I want to add rules that will display validation error messages on textboxes when a user enters invalid data. This would be like when no data is entered entered (left) blank.

    I would like to display a unique error message under each textbox that is incorrect preferably. I would like the error to stand out and be unique with wording and colors being red.

    Can you show me how to accomplish this task?

    If this is not possible, can you show me other ways I can highlight the column and indicate somehow there is a problem and hopefully show what the problem is?


    • Edited by scampsman Wednesday, January 14, 2015 11:27 PM
    Wednesday, January 14, 2015 11:27 PM

Answers

  • I think there is a misunderstanding. You don’t need any C# code to validate the data in the form. InfoPath form is there for non-developer. Simply use InfoPath Validation Rule to validate your data.

    If necessary, you can add text box with validation message and set up Format Rule to show/hide.

    You can also create View as your form review step. Click “Page Design” ribbon tab à Click “New View”. Then, add a button to switch the view in the main form. When user clicks the button it will navigate to review form which is another InfoPath View. I think I’m going too far. You may need to open a new thread since creating a new form (View) is different topic.

    백상하 - Stop hacking my blog http://blog.naver.com/agilepoint
    쉐어포인트 배움터 http://sharepointkorea.com

    • Marked as answer by scampsman Friday, January 16, 2015 10:37 PM
    Thursday, January 15, 2015 8:41 PM

All replies

  • Scamspanm,

    The custom error message only shows up when the submit occurs, and the form doesn't submit if there are validation errors.  If you reproduce the type of error I mentioned, then you will see your custom error message.

    You won't be able to submit a form with errors -- that is kind of the point of Data Validation. However, you should be able to see what fields are causing the errors -- if they don't show on your view of the form, there should be a Details button on the error message that will tell you what fields have the problem. You will want to remove the data validation (or set fields to allow blanks -- that can cause these errors as well) accordingly.

    Also see this link : How to create a custom validation error message that contains the name of the control that is being validated in InfoPath


    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

    Wednesday, January 14, 2015 11:41 PM
  • Please check the link below. It shows you three different options provided in InfoPath.

    http://www.bizsupportonline.net/infopath2007/infopath-basics-3-ways-validate-data-infopath.htm

    You can accomplish your task by using second option (Use InfoPath validation rules or data validation events in InfoPath). When user enters invalid data, it will display customized error message. You can also hide customized error message (text field, calculated field, image, etc) and show it when rule conditions is satisfied (when data is invalid). By doing this, you can apply not only font color but also background color.

    Your alternate approach is also possible. You can set up the rule to apply background color when the data is invalid.

    If you don't like pop-up message when user click submit button, then you may consider to disable or hide submit button until the form data is valid.


    백상하 - Stop hacking my blog http://blog.naver.com/agilepoint
    쉐어포인트 배움터 http://sharepointkorea.com


    Thursday, January 15, 2015 12:00 AM
  • Are there other options like creating another form and/or a submit button if there are any errors on the form?
    Thursday, January 15, 2015 8:18 PM
  • This is the first SharePoint project in my company and they want me  to try to use all the options only out of the box first.

    Thus are there options that will work with not embedding any C# code? I know in the example that you listed above #1 would work. Would that solve my problem?

    Thursday, January 15, 2015 8:21 PM
  • I think there is a misunderstanding. You don’t need any C# code to validate the data in the form. InfoPath form is there for non-developer. Simply use InfoPath Validation Rule to validate your data.

    If necessary, you can add text box with validation message and set up Format Rule to show/hide.

    You can also create View as your form review step. Click “Page Design” ribbon tab à Click “New View”. Then, add a button to switch the view in the main form. When user clicks the button it will navigate to review form which is another InfoPath View. I think I’m going too far. You may need to open a new thread since creating a new form (View) is different topic.

    백상하 - Stop hacking my blog http://blog.naver.com/agilepoint
    쉐어포인트 배움터 http://sharepointkorea.com

    • Marked as answer by scampsman Friday, January 16, 2015 10:37 PM
    Thursday, January 15, 2015 8:41 PM