diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 2892995c..bf71d5df 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -478,12 +478,12 @@ $(function () { } }; - var returnToParent = function(options) { + var returnToParent = function(save) { $('.children-questions').hide(); $('.children-list').show(); - clearQuestionWellError(); + clearQuestionWellError(save); enableChildrenFooterNav({page:'review'}); - saveChildQuestions(options); + saveChildQuestions({persist: save}); populateChildrenFactSheets(); }; @@ -494,10 +494,15 @@ $(function () { } }; - var clearQuestionWellError = function() { + var clearQuestionWellError = function(removeTableError) { $('.children-questions .question-well').each(function () { $(this).removeClass('error'); }); + if (removeTableError) { + var $childrenTable = $('.children-list.question-well'); + $childrenTable.removeClass('error'); + $childrenTable.find('.warning').remove(); + } }; var checkNoEmptyField = function() { @@ -508,14 +513,19 @@ $(function () { var questionWell = $(this); questionWell.removeClass('error'); questionWell.find('input').each(function (index, inputField) { + questionWell.find('.required').hide(); + $(inputField).removeClass('error'); if (inputField.type === 'text') { if (inputField.value === '') { isNotEmpty = false; + $(inputField).addClass('error'); questionWell.addClass('error'); + questionWell.find('.required').show(); } else if (inputField.id === 'childs_birth_date') { if (!moment(inputField.value, "MMM D, YYYY").isValid()) { isNotEmpty = false; questionWell.addClass('error'); + questionWell.find('.required').show(); } } else if (inputField.id === 'childs_name') { // check for digits in the name @@ -528,6 +538,7 @@ $(function () { if (questionWell.find('input:radio:checked').length === 0) { isNotEmpty = false; questionWell.addClass('error'); + questionWell.find('.required').show(); } return false; } @@ -542,7 +553,7 @@ $(function () { $('#btn_save_child').on('click', function(e) { e.preventDefault(); if (checkNoEmptyField() === true) { - returnToParent({persist: true}); + returnToParent(true); } else { scrollToFirstError(); } @@ -557,7 +568,7 @@ $(function () { $('#btn_revert_child').on('click', function(e) { e.preventDefault(); - returnToParent({persist: false}); + returnToParent(false); // Delete the empty row added to the children table when adding new child. // Empty row will always be the last row of the table. diff --git a/edivorce/apps/core/templates/partials/required.html b/edivorce/apps/core/templates/partials/required.html index 396cb4e5..c9419155 100644 --- a/edivorce/apps/core/templates/partials/required.html +++ b/edivorce/apps/core/templates/partials/required.html @@ -1 +1 @@ -* Required \ No newline at end of file + \ No newline at end of file diff --git a/edivorce/apps/core/templates/question/06_children_your_children.html b/edivorce/apps/core/templates/question/06_children_your_children.html index 6ae07ebf..464701d9 100644 --- a/edivorce/apps/core/templates/question/06_children_your_children.html +++ b/edivorce/apps/core/templates/question/06_children_your_children.html @@ -52,7 +52,9 @@ and how they will spend time with each parent.

{% endif %} -
+
+

* You have indicated that you have children of the marriage. This includes children under and over the age of 19. Their details + must be added below.

@@ -82,7 +84,9 @@ @@ -92,7 +96,7 @@
- Add Child + Add Child{% if claimant_children_error %} + {% include 'partials/required.html' with hidden=True %}{% endif %} +