none
Validation rule works, but the error message doesn't show RRS feed

  • Question

  • Hi,

    I've got a Contact Selector control and in the "AccountId" field of this control, I've added a validation rule, so that this field is required on certain condition and based on certain user roles. The validation rule works. If the condition is not fulfilled, the error message shows up. However, the "Message" that is mentioned in the "Data Validation" window doesn't show in the error message if the form is not validated. So, it's hard to know which field has the validation error since Infopath doesn't draw a red border around contact selector tool if validation fails.

    Could you please advise?

    Thanks,


    Pman
    http://www.pmansLab.com/
    Friday, July 9, 2010 5:36 PM

Answers

  • As we've discussed, the contact Selector just doesn't work the same as other controls, because it consists of 5 fields: a non-repeating group, a repeating group, and 3 elements.  You can't put data validation on just one of those fields and expect it to show the red border.  You would have to try and put the data validation on the non-repeating group like you did when you set the rules.  If that doesn't do it, then simply add a hidden section below or beside the contact selector, and add conditional formatting to it so that it only shows an error message (red italicized text inside the section) when the condition is met.
    SharePoint Architect || Microsoft MVP || My Blog
    • Marked as answer by Parvez Akkas Saturday, July 10, 2010 12:22 AM
    Friday, July 9, 2010 5:48 PM

All replies

  • As we've discussed, the contact Selector just doesn't work the same as other controls, because it consists of 5 fields: a non-repeating group, a repeating group, and 3 elements.  You can't put data validation on just one of those fields and expect it to show the red border.  You would have to try and put the data validation on the non-repeating group like you did when you set the rules.  If that doesn't do it, then simply add a hidden section below or beside the contact selector, and add conditional formatting to it so that it only shows an error message (red italicized text inside the section) when the condition is met.
    SharePoint Architect || Microsoft MVP || My Blog
    • Marked as answer by Parvez Akkas Saturday, July 10, 2010 12:22 AM
    Friday, July 9, 2010 5:48 PM
  • Thanks Clayton for your reply.

    I wasn't really concerned about getting red border around the control. I wanted the "Message" that I typed in the validation window, to  show up in the error message window that appears when user tries to submit the form.

    I remember this working for me before, but I've made a lot of changes to other parts of the form already and noticed the issue recently. Just not sure what change caused this form to stop showing the validation message in the error message window even though the validation works fine. Everything looks okay/logical so far.

    I actually looked at the non-repeating group. Although I can add rules in that group, I can't add any validation in there. I think I'll just go with your suggestion about adding a hidden control and using conditional formatting to show red "*" beside the control. At least it has a more visual effect.

    Thanks,

     


    Pman
    http://www.pmansLab.com/
    Saturday, July 10, 2010 12:21 AM
  • After doing some troubleshooting, I found the issue. Thought I'd post here, although I don't have a fix for it.

    In the previous versions of my form, I had a button on the canvus that would act like a submit button. The action of the button was set to "Submit" and the "Submit Options..." was set to submit the form using a data connection. Now, if the button is clicked, it obviously checks all the validation and shows appropriate message that is set on particular control/field's validation settings.

    In the new version of my form, I had changed the button's configuration. The action of the button is now set to "Rules and Custom Code". Then I used Rules to submit the form to the same data connection. Now, when I try to submit the form, the button does go through validation, but it just shows a standard error message about "some rules weren't applied".

    So, basically I can't use rules to submit forms if I want to see detailed validation error messages. It's kinda annoying, but I doubt there's anything that can be done to fix this bug.


    Pman
    http://www.pmansLab.com/
    Monday, July 12, 2010 8:39 PM
  • Genius! I have been searching for hours. It is a custom form so it will only show the default wording! Plus this way I can use it for all the conditions not met that fit the criteria. Well Done!
    Thursday, October 3, 2019 3:07 PM