diff --git a/edivorce/apps/core/static/js/ajax.js b/edivorce/apps/core/static/js/ajax.js index f6864bf5..dae98350 100644 --- a/edivorce/apps/core/static/js/ajax.js +++ b/edivorce/apps/core/static/js/ajax.js @@ -33,13 +33,13 @@ var ajaxOnChange = function () { var getCSRFToken = function () { var name = 'csrftoken'; var cookieValue = null; - if (document.cookie && document.cookie != '') { + if (document.cookie && document.cookie !== '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = $.trim(cookies[i]); // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { + if (cookie.substring(0, name.length + 1) === (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } @@ -59,7 +59,7 @@ var ajaxCall = function(question, value){ { type: 'POST', beforeSend: function (xhr, settings) { - if ((settings.type == 'POST' || settings.type == 'PUT' || settings.type == 'DELETE') && !this.crossDomain) { + if ((settings.type === 'POST' || settings.type === 'PUT' || settings.type === 'DELETE') && !this.crossDomain) { xhr.setRequestHeader("X-CSRFToken", csrf_token); } }, diff --git a/edivorce/apps/core/static/js/functions.js b/edivorce/apps/core/static/js/functions.js index ad21eb9e..c7be9861 100644 --- a/edivorce/apps/core/static/js/functions.js +++ b/edivorce/apps/core/static/js/functions.js @@ -162,14 +162,14 @@ var getValue = function(el, question){ $(this).closest('.form-inline').find('.date') .addClass('has-error'); $(this).closest('.form-inline').find('.form-warning') - .append('You have entered date periods that overlap, please check your dates and enter each period of time separately.'); + .append('You have entered date periods that overlap, please check your dates and enter each period of time separately.'); } } else { $(this).closest('.form-inline').find('.date') .addClass('has-error'); $(this).closest('.form-inline').find('.form-warning') - .append('You have entered an end date (To:) that is earlier than the start date (From:), please check your dates and try again.'); + .append('You have entered an end date (To:) that is earlier than the start date (From:), please check your dates and try again.'); } } }); diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 81b2c9b1..5ab32121 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -118,7 +118,7 @@ $(function () { var proceedNext = $(this).data('proceed'); if (!showAlert) { $(".checkbox-group input:checkbox").not(":checked").each(function () { - if ($(this).val() == 'Division of property and debts' || $(this).val() == 'Spousal support') { + if ($(this).val() === 'Division of property and debts' || $(this).val() === 'Spousal support') { showAlert = true; } }); @@ -130,6 +130,16 @@ $(function () { } }); + // For Prequalification step 3 + // If there is invalid date on reconciliation period, + // prevent user from navigate away from the page when user clicks next or back button, or use side navigation + $('#btn_reconcilaition_back, #btn_reconcilaition_next, .progress-column > a').on('click', function(e){ + if ($('.invalid-date').is(':visible')) { + e.preventDefault(); + $('.invalid-date').parent().siblings('.form-group').find('.reconciliation-from-date').focus(); + } + }); + // spinner $('a.spinner').on('click', function (e) { e.preventDefault(); diff --git a/edivorce/apps/core/templates/prequalification/step_03.html b/edivorce/apps/core/templates/prequalification/step_03.html index e0ded316..c6ba7b93 100644 --- a/edivorce/apps/core/templates/prequalification/step_03.html +++ b/edivorce/apps/core/templates/prequalification/step_03.html @@ -143,8 +143,8 @@ {% block formbuttons %}
{% endblock %}