From d54d79f0aef558e3b024966969e145cdc5599b48 Mon Sep 17 00:00:00 2001 From: Mike Olund Date: Tue, 14 Mar 2017 13:53:04 -0700 Subject: [PATCH] DIV-256 - expand date validation to include reconciliation period dates --- edivorce/apps/core/static/js/ajax.js | 3 +-- edivorce/apps/core/static/js/controllers.js | 4 ++-- .../apps/core/templates/partials/reconciliation_period.html | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/edivorce/apps/core/static/js/ajax.js b/edivorce/apps/core/static/js/ajax.js index 23684754..76c85786 100644 --- a/edivorce/apps/core/static/js/ajax.js +++ b/edivorce/apps/core/static/js/ajax.js @@ -7,9 +7,8 @@ var ajaxOnChange = function () { var value = getValue(el, question); var isValid = true; - // todo: Can this be removed? the forceParse option in the datepicker seems to take care of date validation for us // Check if date is in valid format DD/MM/YYYY - if (el.is(".date-picker")){ + if (el.is(".date-picker") || el.is(".date-pickers")){ isValid = validateDate(el); } diff --git a/edivorce/apps/core/static/js/controllers.js b/edivorce/apps/core/static/js/controllers.js index 98a8f4ef..8eb7c11f 100644 --- a/edivorce/apps/core/static/js/controllers.js +++ b/edivorce/apps/core/static/js/controllers.js @@ -183,7 +183,7 @@ var validateEmail = function(el){ // check if value in date field is in DD/MM/YYYY format // and check if it is valid date and it is today or earlier var validateDate = function(el){ - el.closest('.date-picker-group') + el.closest('.date') .removeClass('has-error') .find('span.help-block') .remove(); @@ -198,7 +198,7 @@ var validateDate = function(el){ return true; } - el.closest('.date-picker-group') + el.closest('.date') .addClass('has-error') .append('Invalid Date'); diff --git a/edivorce/apps/core/templates/partials/reconciliation_period.html b/edivorce/apps/core/templates/partials/reconciliation_period.html index c8c74ff4..ec6ff791 100644 --- a/edivorce/apps/core/templates/partials/reconciliation_period.html +++ b/edivorce/apps/core/templates/partials/reconciliation_period.html @@ -13,5 +13,5 @@ {% input_field type="text" name="reconciliation_period" value=to multiple='true' class="date-pickers reconciliation-to-date form-control" placeholder="DD/MM/YYYY" %} - + \ No newline at end of file