How to set fields to be required when they are displayed on one view but not required when they are not displayed/used on another view? - InfoPath Dev
in

InfoPath Dev

How to set fields to be required when they are displayed on one view but not required when they are not displayed/used on another view?

Last post 09-12-2012 03:15 PM by DC Forms. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-12-2012 01:59 PM

    • DC Forms
    • Top 150 Contributor
      Male
    • Joined on 06-14-2012
    • Washington, DC
    • Posts 76

    How to set fields to be required when they are displayed on one view but not required when they are not displayed/used on another view?

    My form has some simple business logic that determines what view is displayed to users. Depending on the business logic, and hence the view, some fields are displayed and required. I thought that the validation rules were exclusive to the view, but it appears they cross views. I am unsure, because I have seen a behavior where rules appear exclusive to the view in which they are applied. (InfoPath 2010)

    This causes a problem because a field that is required on one view but not a second one prevents the form from being submitted using the second view.

    View A

    • Field 1 is displayed and required using a validation rule (the field properties Cannot be blank attribute is unchecked)
    • Field 2 is not displayed (because it is not required and not relevant)

    View B

    • Field 1 is displayed and required using a validation rule
    • Field 2 is displayed and required using a validation rule

    Issue: View A cannot be submitted because no value has been entered for Field 2

    Is this possible, or do I need separate forms?

  • 09-12-2012 02:22 PM In reply to

    Re: How to set fields to be required when they are displayed on one view but not required when they are not displayed/used on another view?

    Validation rules are specific to the field - not the view. Thus, you may need a way to know when field 2 is required and add custom validation to the field that takes that into account. You can track view switches with qRules - not sure if you will know what view your user will be in? Or do they click a button or something to get to the second view?

    In InfoPath, a view is simply a way of displaying data - validation cares only about the data (XML), not the view or controls. Does that make sense?

    Hilary Stoupa

  • 09-12-2012 03:15 PM In reply to

    • DC Forms
    • Top 150 Contributor
      Male
    • Joined on 06-14-2012
    • Washington, DC
    • Posts 76

    Re: How to set fields to be required when they are displayed on one view but not required when they are not displayed/used on another view?

    Rules are run when the form is opened to determine which view is displayed. I could go through and add the same conditions to the validation rules that I use to determine what views are displayed, but it would easier to use separate forms.

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