Add validation to form for enforcing chronological order of PoP start and end dates

This commit is contained in:
leigh-mil
2019-08-01 13:41:05 -04:00
parent 0493078b33
commit 25ab64f748
5 changed files with 41 additions and 8 deletions

View File

@@ -80,10 +80,10 @@
</div>
</div>
<p class="usa-input-error-message" v-bind:class="{ 'form-has-errors': !isWithinDateRange }">
{% if maxdate and mindate %}Date must be between {{mindate.strftime("%m/%d/%Y")}} and {{maxdate.strftime("%m/%d/%Y")}}{% endif %}
{% if maxdate and not mindate %}Date must be before or on {{maxdate.strftime("%m/%d/%Y")}}{% endif %}
{% if mindate and not maxdate %}Date must be after or on {{mindate.strftime("%m/%d/%Y")}}{% endif %}
<p class="usa-input-error-message" v-bind:class='{% if field.errors %}"form-has-errors"{% endif %}'>
{% if field.errors %}
{{ field.errors[0] }}
{% endif %}
</p>
</fieldset>
</date-selector>