Skip to content

Commit 0abde44

Browse files
fix(questionnaire): missing information now in correct place (#443)
* fix(questionnair): missing information now in correct place it now displays the correct message "Please read & accept" instead of missing information and the notification is now in the correct place * Update app/assets/javascripts/validate.js * Revert "Update app/assets/javascripts/validate.js" This reverts commit bc54783. Signed-off-by: Peter Kos <[email protected]> Co-authored-by: Peter Kos <[email protected]>
1 parent 002bb14 commit 0abde44

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

app/assets/javascripts/validate.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ document.addEventListener('turbolinks:load', function() {
2222
$(this)
2323
.parent()
2424
.text()
25-
.includes('I accept')
25+
.includes('I read and accept')
2626
) {
27-
notify(this, 'Please read & accept');
27+
notify(".agreement_input", 'Please read & accept');
2828
} else {
2929
notify(this, 'Missing Information');
3030
}
@@ -79,6 +79,13 @@ document.addEventListener('turbolinks:load', function() {
7979
.fadeOut(200, function() {
8080
$(this).remove();
8181
});
82+
$(".agreement_input")
83+
.parent()
84+
.removeClass('field_with_errors')
85+
.find('.error')
86+
.fadeOut(200, function() {
87+
$(this).remove();
88+
});
8289
}
8390
return success;
8491
};

app/views/questionnaires/_form.html.haml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
%strong Agreements
5353
%p Please review the agreements and click the corresponding checkbox next to each agreement to agree.
5454
.form-inputs
55-
= f.association :agreements, as: :check_boxes, label_method: :formatted_agreement, value_method: :id, label: "", wrapper_html: { style: 'display: block' }, input_html: { "data-validate" => "presence" }
55+
.agreement_input
56+
= f.association :agreements, as: :check_boxes, label_method: :formatted_agreement, value_method: :id, label: "", wrapper_html: { style: 'display: block' }, input_html: { "data-validate" => "presence" }
5657

5758
.right
5859
%button.button{ type: "button", "data-wizard" => "previous" } Previous

0 commit comments

Comments
 (0)