From 9fc8474de21fd678c1aabc5cc1b80c1f36dc17c6 Mon Sep 17 00:00:00 2001 From: ariannedee Date: Wed, 26 Aug 2020 12:52:52 -0700 Subject: [PATCH] Trim whitespace so fields with only spaces are considered unfilled. --- edivorce/apps/core/static/js/functions.js | 2 +- edivorce/apps/core/utils/conditional_logic.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/edivorce/apps/core/static/js/functions.js b/edivorce/apps/core/static/js/functions.js index 462ff509..31f70cdc 100644 --- a/edivorce/apps/core/static/js/functions.js +++ b/edivorce/apps/core/static/js/functions.js @@ -289,7 +289,7 @@ var getValue = function(el, question){ $('#other_names_fields').find("input[type=text]").each(function () { // as per request, alias type will always be also known as for now // aliasType = $(this).val() === '' ? '' : $(this).siblings(".alias-type").val(); - value.push([aliasType, $(this).val()]); + value.push([aliasType, $(this).val().trim()]); }); return JSON.stringify(value); } diff --git a/edivorce/apps/core/utils/conditional_logic.py b/edivorce/apps/core/utils/conditional_logic.py index fb62f142..5ce0265e 100644 --- a/edivorce/apps/core/utils/conditional_logic.py +++ b/edivorce/apps/core/utils/conditional_logic.py @@ -130,7 +130,10 @@ def determine_missing_extraordinary_expenses(questions_dict): def get_cleaned_response_value(response): - ignore_values = [None, '', '[]', '[["",""]]', '[["also known as",""]]'] + if response is None: + return None + response = response.strip() + ignore_values = ['', '[]', '[["",""]]', '[["also known as",""]]'] if response not in ignore_values: return response return None