Réparer les scripts intégrés aux vues
This commit is contained in:
parent
63224d8b06
commit
64ce1285aa
12 changed files with 112 additions and 97 deletions
|
|
@ -185,19 +185,19 @@
|
|||
summary = document.getElementById('formValidationError');
|
||||
|
||||
function frenchMessage(field) {
|
||||
if (field.validity.valueMissing) return < ? = json_encode(t('auth.required'), JSON_UNESCAPED_UNICODE) ? > ;
|
||||
if (field.validity.tooShort) return < ? = json_encode(t('auth.password_min', ['count' => '__COUNT__']),
|
||||
JSON_UNESCAPED_UNICODE) ? > .replace('__COUNT__', field.minLength);
|
||||
if (field.validity.patternMismatch) return < ? = json_encode(t('auth.invalid_format'),
|
||||
JSON_UNESCAPED_UNICODE) ? > ;
|
||||
return < ? = json_encode(t('auth.check_field'), JSON_UNESCAPED_UNICODE) ? > ;
|
||||
if (field.validity.valueMissing) return <?= json_encode(t('auth.required'), JSON_UNESCAPED_UNICODE) ?> ;
|
||||
if (field.validity.tooShort) return <?= json_encode(t('auth.password_min', ['count' => '__COUNT__']),
|
||||
JSON_UNESCAPED_UNICODE) ?> .replace('__COUNT__', field.minLength);
|
||||
if (field.validity.patternMismatch) return <?= json_encode(t('auth.invalid_format'),
|
||||
JSON_UNESCAPED_UNICODE) ?> ;
|
||||
return <?= json_encode(t('auth.check_field'), JSON_UNESCAPED_UNICODE) ?> ;
|
||||
}
|
||||
form.addEventListener('submit', event => {
|
||||
form.querySelectorAll('.is-invalid').forEach(el => el.classList.remove('is-invalid'));
|
||||
const password = form.elements.password,
|
||||
confirmation = form.elements.password_confirm;
|
||||
if (confirmation) confirmation.setCustomValidity(password.value !== confirmation.value ? < ? =
|
||||
json_encode(t('auth.password_mismatch'), JSON_UNESCAPED_UNICODE) ? > : '');
|
||||
if (confirmation) confirmation.setCustomValidity(password.value !== confirmation.value ? <?=
|
||||
json_encode(t('auth.password_mismatch'), JSON_UNESCAPED_UNICODE) ?> : '');
|
||||
if (!form.checkValidity()) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue