Browse Source

DIV-256 - expand date validation to include reconciliation period dates

pull/160/head
Mike Olund 8 years ago
parent
commit
d54d79f0ae
3 changed files with 4 additions and 5 deletions
  1. +1
    -2
      edivorce/apps/core/static/js/ajax.js
  2. +2
    -2
      edivorce/apps/core/static/js/controllers.js
  3. +1
    -1
      edivorce/apps/core/templates/partials/reconciliation_period.html

+ 1
- 2
edivorce/apps/core/static/js/ajax.js View File

@ -7,9 +7,8 @@ var ajaxOnChange = function () {
var value = getValue(el, question); var value = getValue(el, question);
var isValid = true; 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 // 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); isValid = validateDate(el);
} }


+ 2
- 2
edivorce/apps/core/static/js/controllers.js View File

@ -183,7 +183,7 @@ var validateEmail = function(el){
// check if value in date field is in DD/MM/YYYY format // 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 // and check if it is valid date and it is today or earlier
var validateDate = function(el){ var validateDate = function(el){
el.closest('.date-picker-group')
el.closest('.date')
.removeClass('has-error') .removeClass('has-error')
.find('span.help-block') .find('span.help-block')
.remove(); .remove();
@ -198,7 +198,7 @@ var validateDate = function(el){
return true; return true;
} }
el.closest('.date-picker-group')
el.closest('.date')
.addClass('has-error') .addClass('has-error')
.append('<span class="help-block">Invalid Date</span>'); .append('<span class="help-block">Invalid Date</span>');


+ 1
- 1
edivorce/apps/core/templates/partials/reconciliation_period.html View File

@ -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" %} {% input_field type="text" name="reconciliation_period" value=to multiple='true' class="date-pickers reconciliation-to-date form-control" placeholder="DD/MM/YYYY" %}
</span> </span>
</div> </div>
<input type="button" class="btn btn-danger btn-delete-period form-control pull-right" value="Delete" />
<input type="button" class="btn btn-danger btn-delete-period form-control pull-right" tabindex="-1" value="Delete" />
</div> </div>

Loading…
Cancel
Save