<script>
function chiffres() {
// si l'option selectionnée a pour valeur 67
if (document.validation.departement.options[document.validation.departement.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.validation.departement.value)) {
//un traitement quelconque
}
else {
alert('Veuillez saisir le téléphone sous format 00 00 00 00 00');
document.validation.departement.value = "";
}
}
}
</script>
<form method="post" onSubmit="return checkbae()" action="http://localhost/lists/?p=subscribe&id=1" name="validation" target = "_self">
Pays</td>
<td><select name="departement" id="departement">
<option value="67">Bas-Rhin (67)</option>
<option value="68">Haut-Rhin (68)</option>
</select>
Telephone
<input type=text name="attribute21" class="attributeinput" size="40" onBlur="chiffres(event)" maxLength="20" value="00 00 00 00 00" >
<script>
function chiffres() {
// si l'option selectionnée a pour valeur 67
if (document.validation.departement.options[document.validation.departement.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.validation.attribute21.value)) {
//un traitement quelconque
}
else {
alert('Veuillez saisir le téléphone sous format 00 00 00 00 00');
document.validation.attribute21.value = "";
}
}
}
</script>
<form method="post" onSubmit="return checkbae()" action="http://localhost/lists/?p=subscribe&id=1" name="validation" target = "_self">
Pays</td>
<td><select name="departement" id="departement">
<option value="67">Bas-Rhin (67)</option>
<option value="68">Haut-Rhin (6Cool</option>
</select>
Telephone
<input type=text name="attribute21" class="attributeinput" size="40" onBlur="chiffres(event)" maxLength="20" value="00 00 00 00 00" >
Code : Tout sélectionner
00 00 00 00 00Code : Tout sélectionner
reg = new RegExp(/[0-9]{2}\\.[0-9]{2}\\.[0-9]{2}\\.[0-9]{2}\\.[0-9]{2}/);