1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <?php <script>
function chiffres() {
// si l'option selectionnée a pour valeur 67
if (document.validation.attribute21.options[document.validation.attribute21.selectedIndex].value == 67) {
reg = new RegExp(/[0-9]{2}[.][0-9]{2}[.][0-9]{2}[.][0-9]{2}[.][0-9]{2}/);
if (reg.test(document.form1.attribute21.value)) {
//un traitement quelconque
}
else {
alert('Veuillez saisir le téléphone sous format XX.XX.XX.XX.XX');
document.validation.attribute21.value = "";
}
}
}
</script>
<form method="post" onSubmit="return checkbae()" action="http://localhost/lists/?p=subscribe&id=1" name="validation" target = "_self">
telephone
<select name="departement" id="departement">
<option value="67">Bas-Rhin (67)</option>
<option value="68">Haut-Rhin (6Cool</option>
</select>
<input type=text name="attribute21" class="attributeinput" size="40" onBlur="chiffres(event)" maxLength="20" value=""> |