Form is invalid if no file is uploaded

This commit is contained in:
Montana 2018-08-27 14:51:04 -04:00
parent be080ed205
commit cb2569c504
2 changed files with 11 additions and 3 deletions

View File

@ -218,5 +218,8 @@ class ExtendedFinancialForm(BaseFinancialForm):
task_order = FileField(
"Upload a copy of your Task Order",
validators=[FileAllowed(["pdf"], "Only PDF documents can be uploaded.")],
validators=[
FileAllowed(["pdf"], "Only PDF documents can be uploaded."),
Required(),
],
)

View File

@ -95,8 +95,13 @@
validation='integer'
) }}
<div class="usa-input usa-input--validation--anything {% if f.task_order.errors %} usa-input--error {% endif %}">
{{ f.task_order.label }}
{{ f.task_order }}
{% for error in f.task_order.errors %}
<span class="usa-input__message">{{error}}</span>
{% endfor %}
</div>
</fieldset>
{% endif %}