From c5dfcbab5e2db2849e587322df8390c97a3bda7a Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 6 Feb 2019 10:44:15 -0500 Subject: [PATCH 1/2] Fix validation messages for updating portfolio name --- js/lib/input_validations.js | 2 +- translations.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/lib/input_validations.js b/js/lib/input_validations.js index c8b0c897..5016f192 100644 --- a/js/lib/input_validations.js +++ b/js/lib/input_validations.js @@ -122,6 +122,6 @@ export default { match: /^.{4,100}$/, unmask: [], validationError: - 'Portfolio and request names must be at least 4 and not more than 100 characters', + 'Portfolio names must be at least 4 and not more than 100 characters', }, } diff --git a/translations.yaml b/translations.yaml index 48579fcb..46df4898 100644 --- a/translations.yaml +++ b/translations.yaml @@ -254,7 +254,7 @@ forms: is_required: This field is required. portfolio: name_label: Portfolio Name - name_length_validation_message: Portfolio names must be at least 4 and not more than 50 characters + name_length_validation_message: Portfolio names must be at least 4 and not more than 100 characters fragments: edit_application_form: existing_application_title: 'Edit {application_name} application' From 6cc6e23c092bc33aaeaa2fd2c1f3a92d4471483d Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Wed, 6 Feb 2019 10:48:37 -0500 Subject: [PATCH 2/2] Add validation to portfolio name in the TO form --- atst/forms/task_order.py | 9 ++++++++- templates/task_orders/new/app_info.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/atst/forms/task_order.py b/atst/forms/task_order.py index 7d1c2167..7b5f42e4 100644 --- a/atst/forms/task_order.py +++ b/atst/forms/task_order.py @@ -31,7 +31,14 @@ class AppInfoForm(CacheableForm): portfolio_name = StringField( translate("forms.task_order.portfolio_name_label"), 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( translate("forms.task_order.scope_label"), diff --git a/templates/task_orders/new/app_info.html b/templates/task_orders/new/app_info.html index 85b52a6c..a5cd23d7 100644 --- a/templates/task_orders/new/app_info.html +++ b/templates/task_orders/new/app_info.html @@ -13,7 +13,7 @@

{{ "task_orders.new.app_info.basic_info_title"| translate }}

-{{ 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) }}

{{ "task_orders.new.app_info.sample_scope" | translate | safe }}