This commit is contained in:
KONE SOREL 2026-02-18 12:32:43 +00:00
parent a9e381ab79
commit ff1f456fcd

View File

@ -169,9 +169,22 @@
</label>
<div class="input-group">
<span class="input-group-text bg-white text-muted"><i class="fas fa-mobile-alt"></i></span>
<input type="tel" class="form-control" id="telephonePortable" name="telephonePortable" required minlength="12">
<input type="tel"
class="form-control"
id="telephonePortable"
name="telephonePortable"
placeholder="Ex: 250700000001"
required
pattern="^250[0-9]{9,}$"
title="<?= est_anglophone() ? "The number must start with 250 and contain at least 12 digits." : "Le numéro doit commencer par 250 et comporter au moins 12 chiffres.";?>"
oninput="this.setCustomValidity('')"
oninvalid="this.setCustomValidity('<?= est_anglophone() ? 'The number must mandatorily start with 250 and contain at least 12 digits in total.' : 'Le numéro doit obligatoirement commencer par 250 et contenir au moins 12 chiffres au total.';?>')">
</div>
<div class="form-text text-muted small">
<i class="fas fa-info-circle"></i> <?= est_anglophone() ? 'Required format: 250XXXXXXXXX (min. 12 digits)' : 'Format requis : 250XXXXXXXXX (min. 12 chiffres)'; ?>
</div>
</div>
<div class="col-md-6">
<label class="form-label fw-bold small text-uppercase"><?= _("Téléphone Fixe") ?></label>
<input type="tel" class="form-control" id="telephonFixe" name="telephonFixe">
@ -236,4 +249,16 @@
</div>
</div>
<?php endif; ?>
</div>
</div>
<script>
document.getElementById('telephonePortable').addEventListener('input', function (e) {
const pattern = /^250[0-9]{9,}$/;
if (pattern.test(this.value)) {
this.classList.remove('is-invalid');
this.classList.add('is-valid');
} else {
this.classList.remove('is-valid');
this.classList.add('is-invalid');
}
});
</script>