Skip to content

Commit

Permalink
fix: Validations were not visually updating when interacting
Browse files Browse the repository at this point in the history
  • Loading branch information
AyakorK committed Dec 8, 2023
1 parent 44435e3 commit b6c48a4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/packs/entrypoints/application.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import "src/signup_form.js"
import "src/confirmation_registration.js"

28 changes: 28 additions & 0 deletions app/packs/src/confirmation_registration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$(document).ready(() => {
$("#user_certification").on("change", function(e) {
const certificationField = event.target.parentNode.parentNode;
const certificationError = certificationField.querySelector('.form-error');

if (certificationError) {
certificationError.remove();
}
});

$(".select-date-container").on("change", function(e) {
const dateField = event.target.parentNode.parentNode;
const dateError = dateField.querySelectorAll('.form-error');
const invalidFields = dateField.querySelectorAll('.is-invalid-input');

if (dateError) {
dateError.forEach(error => {
error.remove();
});
}

if (invalidFields) {
invalidFields.forEach(field => {
field.classList.remove('is-invalid-input');
});
}
});
});
2 changes: 1 addition & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fr:
address: Addresse
birth_date: Date de naissance
birth_date_help: Vous devez avoir plus de 16 ans pour avoir accès à ce service.
certification: Certification CESE
certification: Je certifie l'exactitude de ces informations.
city: Ville
code: Code postal
complete_profile: Complétez votre profil
Expand Down

0 comments on commit b6c48a4

Please sign in to comment.