Js Expression reguliere a accent
Fermé
Yorundr
Messages postés
289
Date d'inscription
mardi 31 octobre 2006
Statut
Membre
Dernière intervention
11 juin 2012
-
25 juil. 2008 à 09:39
sipatsymasaka Messages postés 99 Date d'inscription vendredi 1 octobre 2010 Statut Membre Dernière intervention 28 novembre 2014 - 30 nov. 2011 à 12:12
sipatsymasaka Messages postés 99 Date d'inscription vendredi 1 octobre 2010 Statut Membre Dernière intervention 28 novembre 2014 - 30 nov. 2011 à 12:12
A voir également:
- Js Expression reguliere a accent
- Téléchargez cette archive (dossier compressé). en extraire tous les fichiers dans un dossier local. quel fichier contient l’expression trouverpix ? ✓ - Forum Windows
- Comment faire un accent circonflexe sur un clavier azerty ✓ - Forum Windows Vista
- Round js ✓ - Forum Javascript
- A accent majuscule - Guide
- U accent grave clavier ✓ - Forum Windows
2 réponses
sipatsymasaka
Messages postés
99
Date d'inscription
vendredi 1 octobre 2010
Statut
Membre
Dernière intervention
28 novembre 2014
6
30 nov. 2011 à 09:57
30 nov. 2011 à 09:57
les caractères acceptés sont: les chiffre+ les lettres accentues ou non+'+-+_ +.,si ça peut aider ceux qui tombent par ici:
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<script type="text/javascript">
function verifier_champs(){
if(document.getElementById('new_name').value == ''){
alert('Vous devez saisir un nom.');
return false;
}
if( !(/^([0-9A-Za-z- _\.\'\éèàêâîù])+/i.test(document.getElementById('new_name').value)) ){
alert('Le nom ne doit pas contenir de caractères spéciaux.');
return false;
}
return true;
}
</script>
<form method="post" action="" id="addStaff" onsubmit="return verifier_champs()">
<span style="font-size: 14px;color: red;"> Must have a name</span><br>
<label>Name</label><input type="text" name="new_name" id="new_name"><br>
<label>Surname</label><input type="text" name="new_surname" id="new_surname"><br>
<input type="submit" value="Add">
</form>
</body>
</html>
sipatsymasaka
Messages postés
99
Date d'inscription
vendredi 1 octobre 2010
Statut
Membre
Dernière intervention
28 novembre 2014
6
30 nov. 2011 à 12:12
30 nov. 2011 à 12:12
j'ai trouver un erreur,il nous faut une boucle:
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<script type="text/javascript">
function verifier_champs(){
if(document.getElementById('new_name').value == ''){
alert('Vous devez saisir un nom.');
return false;
}
var chkZ = 1;
for(i=0;i<document.getElementById('new_name').value.length;++i){
if(!(/^([0-9A-Za-z- _\.\'\éèàêâîù])+/i.test(document.getElementById('new_name').value.charAt(i))))
chkZ = -1;
}
if(chkZ == -1){
alert('Evitez les caracteres speciaux.');
return false;
}
return true;
}
</script>
<form method="post" action="" id="addStaff" onsubmit="return verifier_champs()">
<span style="font-size: 14px;color: red;"> Must have a name</span><br>
<label>Name</label><input type="text" name="new_name" id="new_name"><br>
<label>Surname</label><input type="text" name="new_surname" id="new_surname"><br>
<input type="submit" value="Add">
</form>
</body>
</html>