diff --git a/app/assets/javascripts/validate.js b/app/assets/javascripts/validate.js index 8da91b2f8..03f883301 100644 --- a/app/assets/javascripts/validate.js +++ b/app/assets/javascripts/validate.js @@ -22,9 +22,9 @@ document.addEventListener('turbolinks:load', function() { $(this) .parent() .text() - .includes('I accept') + .includes('I read and accept') ) { - notify(this, 'Please read & accept'); + notify(".agreement_input", 'Please read & accept'); } else { notify(this, 'Missing Information'); } @@ -79,6 +79,13 @@ document.addEventListener('turbolinks:load', function() { .fadeOut(200, function() { $(this).remove(); }); + $(".agreement_input") + .parent() + .removeClass('field_with_errors') + .find('.error') + .fadeOut(200, function() { + $(this).remove(); + }); } return success; }; diff --git a/app/views/questionnaires/_form.html.haml b/app/views/questionnaires/_form.html.haml index 689ea67e9..ba8a35948 100644 --- a/app/views/questionnaires/_form.html.haml +++ b/app/views/questionnaires/_form.html.haml @@ -52,7 +52,8 @@ %strong Agreements %p Please review the agreements and click the corresponding checkbox next to each agreement to agree. .form-inputs - = f.association :agreements, as: :check_boxes, label_method: :formatted_agreement, value_method: :id, label: "", wrapper_html: { style: 'display: block' }, input_html: { "data-validate" => "presence" } + .agreement_input + = f.association :agreements, as: :check_boxes, label_method: :formatted_agreement, value_method: :id, label: "", wrapper_html: { style: 'display: block' }, input_html: { "data-validate" => "presence" } .right %button.button{ type: "button", "data-wizard" => "previous" } Previous