From b746a92db9cc3512aac1e8b345c109d6bd109d3f Mon Sep 17 00:00:00 2001 From: ariannedee Date: Tue, 25 Aug 2020 17:59:34 -0700 Subject: [PATCH] Add required fields for ones that are sometimes pre-selected --- edivorce/apps/core/static/js/main.js | 16 ++++++++++++++++ .../templates/question/06_children_facts.html | 3 ++- .../templates/question/06_children_what_for.html | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 7d92e96a..a3a36781 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -727,6 +727,22 @@ $(function () { } }); + // The question child_support_in_order is required, but if child support isn't in want_which_orders + // the question is disabled and it is automatically set to NO and saved to the DB + var setWantChildOrder = function () { + var noChildSupportOption = $('input[name="child_support_in_order"][value="NO"]'); + var optionInPage = noChildSupportOption.length > 0; + if (optionInPage) { + var optionIsUnchecked = noChildSupportOption.prop('checked') === false; + var childSupportNotInOrders = noChildSupportOption.data('no_child_order') === true; + if (optionIsUnchecked && childSupportNotInOrders) { + noChildSupportOption.prop('checked', true); + ajaxCall('child_support_in_order', 'NO'); + } + } + } + setWantChildOrder(); + // 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 diff --git a/edivorce/apps/core/templates/question/06_children_facts.html b/edivorce/apps/core/templates/question/06_children_facts.html index 882a7f31..adab98fd 100644 --- a/edivorce/apps/core/templates/question/06_children_facts.html +++ b/edivorce/apps/core/templates/question/06_children_facts.html @@ -22,7 +22,7 @@ {% include "partials/fact_sheets/fact_sheet_c.html" %} {% endif %} -
+
{% money_input_field name="annual_gross_income" hidden="true" %} {% money_input_field name="spouse_annual_gross_income" hidden="true" %} @@ -38,6 +38,7 @@ payor ? + {% if child_support_payor_error %}{% include 'partials/required.html' %}{% endif %} {% if derived.show_fact_sheet_b %}

diff --git a/edivorce/apps/core/templates/question/06_children_what_for.html b/edivorce/apps/core/templates/question/06_children_what_for.html index eb66340c..23c4fd8a 100644 --- a/edivorce/apps/core/templates/question/06_children_what_for.html +++ b/edivorce/apps/core/templates/question/06_children_what_for.html @@ -89,7 +89,7 @@ {% else %} -

This option has been automatically selected for you because you indicated in Step 1 you didn't want an "Order pertaining to children"