diff --git a/cmd/web-app/static/assets/js/custom.js b/cmd/web-app/static/assets/js/custom.js index 869a01a..f8e91d2 100644 --- a/cmd/web-app/static/assets/js/custom.js +++ b/cmd/web-app/static/assets/js/custom.js @@ -1,19 +1,28 @@ $(document).ready(function() { - // Prevent duplicate validation messages. When the validation error is displayed inline - // when the form value, don't display the form error message at the top of the page. - $(this).find('#page-content form').find('input, select, textarea').each(function(index){ + hideDuplicateValidationFieldErrors(); + +}); + +// Prevent duplicate validation messages. When the validation error is displayed inline +// when the form value, don't display the form error message at the top of the page. +function hideDuplicateValidationFieldErrors() { + $(document).find('#page-content form').find('input, select, textarea').each(function(index){ var fname = $(this).attr('name'); if (fname === undefined) { return; } var vnode = $(this).parent().find('div.invalid-feedback'); + if (vnode.length == 0) { + vnode = $(this).parent().parent().find('div.invalid-feedback'); + } + var formField = $(vnode).attr('data-field'); $(document).find('div.validation-error').find('li').each(function(){ if ($(this).attr('data-form-field') == formField) { - if ($(vnode).is(":visible")) { + if ($(vnode).is(":visible") || $(vnode).css('display') === 'none') { $(this).hide(); } else { console.log('form validation feedback for '+fname+' is not visable, display main.'); @@ -21,5 +30,4 @@ $(document).ready(function() { } }); }); - -}); +} \ No newline at end of file diff --git a/cmd/web-app/templates/content/signup-step1.gohtml b/cmd/web-app/templates/content/signup-step1.gohtml index 95669a0..57b5c86 100644 --- a/cmd/web-app/templates/content/signup-step1.gohtml +++ b/cmd/web-app/templates/content/signup-step1.gohtml @@ -15,7 +15,10 @@