Constraints on the Obs Dates within HTML Form Entry

I am wondering how to setup additional constraints on the obs dates:

  1. Future dates after the current encounter date for example a return visit date which has to be after the date of the current encounter. The allowFutureDates=“true” means that a user can select both past and future dates, but there is no option of only selecting future dates.

  2. Ensuring that the obs date is before the current encounter date.

Hi @ssmusoke,

I don’t know that there is currently a tag for doing what you need with the dates in HTML Form Entry. I would vote for a tag like that, because I’ve ran into that use case before. Ask @mogoodrich.

I recommend that JavaScript might be your friend for this if you can’t wait for a new tag. You can use the…

getValue(‘encounterDate.value’)

and

getValue(‘return_visit_date.value’)

…to evaluate the dates that are entered. You can then do a popup, or error when the form is submitted, depending on what you like. See the complete reference for these functions at… https://wiki.openmrs.org/display/docs/HTML+Form+Entry+JavaScript+Reference

Thanks @arbaughj I am leveraging the Javascript in the mean time