Add validation to portfolio name in the TO form

This commit is contained in:
leigh-mil 2019-02-06 10:48:37 -05:00
parent c5dfcbab5e
commit 6cc6e23c09
2 changed files with 9 additions and 2 deletions

View File

@ -31,7 +31,14 @@ class AppInfoForm(CacheableForm):
portfolio_name = StringField( portfolio_name = StringField(
translate("forms.task_order.portfolio_name_label"), translate("forms.task_order.portfolio_name_label"),
description=translate("forms.task_order.portfolio_name_description"), description=translate("forms.task_order.portfolio_name_description"),
validators=[Required()], validators=[
Required(),
Length(
min=4,
max=100,
message=translate("forms.portfolio.name_length_validation_message"),
),
],
) )
scope = TextAreaField( scope = TextAreaField(
translate("forms.task_order.scope_label"), translate("forms.task_order.scope_label"),

View File

@ -13,7 +13,7 @@
<!-- App Info Section --> <!-- App Info Section -->
<h3 class="task-order-form__heading subheading">{{ "task_orders.new.app_info.basic_info_title"| translate }}</h3> <h3 class="task-order-form__heading subheading">{{ "task_orders.new.app_info.basic_info_title"| translate }}</h3>
{{ TextInput(form.portfolio_name, placeholder="The name of your office or organization") }} {{ TextInput(form.portfolio_name, placeholder="The name of your office or organization", validation="portfolioName") }}
{{ TextInput(form.scope, paragraph=True) }} {{ TextInput(form.scope, paragraph=True) }}
<p><i>{{ "task_orders.new.app_info.sample_scope" | translate | safe }}</i></p> <p><i>{{ "task_orders.new.app_info.sample_scope" | translate | safe }}</i></p>
<div class="subheading--black"> <div class="subheading--black">