How to validate a date relative to the encounter date


  1. Find the date element for the observation
    Image:InfoPath Data Sources.png
  2. Drag the observation's date field onto the form
    Image:InfoPath Date Field.png
  3. Right-click on the date field and select **Data Validation**
    Image:InfoPath Date Field Properties.png
  4. In the data validation dialog, select your criteria. In this example, we will enforce that the date must not occur after the encounter date.
    Image:InfoPath Data Validation of Date.png
    After selecting the **Selection field or group...** option, we select the encounter date time field:
    Image:InfoPath Selecting Encounter Datetime.png
  5. Enter an appropriate tip and message for the user. The tip will show when the mouse hovers over the error and the message will show when additional information is needed. You have the option to **Show dialog messages immediately when user enters invalid data**; however, this disrupts workflow.
    Image:InfoPath Data Validation of Date 2.png
  6. Previewing the form shows that an error message will be presented when the date entered for the observation is greater (later) than the date of the encounter:
    Image:InfoPath Invalid Date.png