From b6c48a40d541ba4c934ab2e4fa500513087edf22 Mon Sep 17 00:00:00 2001 From: AyakorK Date: Fri, 8 Dec 2023 09:37:27 +0100 Subject: [PATCH] fix: Validations were not visually updating when interacting --- app/packs/entrypoints/application.js | 1 + app/packs/src/confirmation_registration.js | 28 ++++++++++++++++++++++ config/locales/fr.yml | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/packs/src/confirmation_registration.js diff --git a/app/packs/entrypoints/application.js b/app/packs/entrypoints/application.js index 7517a59..f11f871 100644 --- a/app/packs/entrypoints/application.js +++ b/app/packs/entrypoints/application.js @@ -1,2 +1,3 @@ import "src/signup_form.js" +import "src/confirmation_registration.js" diff --git a/app/packs/src/confirmation_registration.js b/app/packs/src/confirmation_registration.js new file mode 100644 index 0000000..88fc7e3 --- /dev/null +++ b/app/packs/src/confirmation_registration.js @@ -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'); + }); + } + }); +}); \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 8f700c3..7c5f608 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -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