Formulaires

Accepter tel ou mail form (Armand)

<!-- Validation des champs email et tel -->
<script>
const btn = document.querySelector('._w-form-input-cta .btn-form')
const els = document.querySelectorAll('._w-form-input-cta .form-field-cta')
btn.disabled = true
btn.classList.add('disabled')
els.forEach((e, i) => {
const onChange = (ev) => {
console.log(ev)
if (i === 0) {
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
const isEmail = emailRegex.test(String(ev.target.value).toLowerCase())
if (isEmail) {
btn.disabled = false
btn.classList.remove('disabled')
} else {
btn.disabled = true
btn.classList.add('disabled')
}
}
if (i === 1) {
const phoneRegex = /^((\+)33|0)[1-9](\d{2}){4}$/g
const isPhone = phoneRegex.test(String(ev.target.value).toLowerCase())
if (isPhone) {
btn.disabled = false
btn.classList.remove('disabled')
} else {
btn.disabled = true
btn.classList.add('disabled')
}
}
}
e.addEventListener('input', onChange)
})
</script>

<!-- No-scroll quand le menu mobile est ouvert -->
<script>
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#navigation-hamburger').forEach(trigger => {
trigger.addEventListener('click', function(){
this.x = ((this.x || 0) + 1)%2;
if(this.x){
document.querySelectorAll('.body-new').forEach(target => target.classList.add('no-scroll'));
}
else{
document.querySelectorAll('.body-new').forEach(target => target.classList.remove('no-scroll'));
}
});
});
});
</script>

Bug empty accepted

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.