diff --git a/edivorce/apps/core/static/js/ajax.js b/edivorce/apps/core/static/js/ajax.js index d8bb9a24..e545e000 100644 --- a/edivorce/apps/core/static/js/ajax.js +++ b/edivorce/apps/core/static/js/ajax.js @@ -5,6 +5,17 @@ var ajaxOnChange = function () { // show/hide additional information if needed reveal(el); + var isValid = true; + + // Check if date is in valid format DD/MM/YYYY + if (el.is(".date-picker") || el.is(".date-pickers") || el.is(".date-picker-future")){ + isValid = validateDate(el); + } + + if (el.is("#email_textbox")){ + isValid = validateEmail(el); + } + var skipAjax = el.attr('data-skip_ajax'); if (skipAjax !== undefined && skipAjax === "true") { return; @@ -22,16 +33,6 @@ var ajaxOnChange = function () { var question = el.prop('name'); var value = getValue(el, question); - var isValid = true; - - // Check if date is in valid format DD/MM/YYYY - if (el.is(".date-picker") || el.is(".date-pickers") || el.is(".date-picker-future")){ - isValid = validateDate(el); - } - - if (el.is("#email_textbox")){ - isValid = validateEmail(el); - } // special behaviour for radio button with textbox radioWithTextboxControl(el);