Double action dans un formulaire html

Résolu
Bonjour,
J'ai un souci avec mon formulaire html.
Je vous explique :

J ai cree un formulaire qui par le biais d une page de type : envoie_post.php remplie ma base de donnée. J ai rajoute une fonction javascript afin de rendre mes champs obligatoire .Le proble est que mon formulaire n'arrive pas a executer les deux action. s il verifie le formulaire il ne l envoie plus a la bbd
Et inversement...

SVP aider moi je sais plus quoi faire.

Debut de code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">

<head>
<title>Ced</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<script>

/*Script téléchargé sur EasyScript (www.easy-script.com)*/

function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("Vous n'avez pas rempli tous les champs obligatoires !!!")
return false
}
else
return true
}
</script>
<body>

<form action="envoi_post.php" method="post">
</form>
<form onsubmit="return checkrequired(this)">

FIN de code
<p align="center"><input type="submit" value="Envoyer">
</p>
</td>
<td width="349" height="196" valign="middle" style="border-style: none; border-width: medium" align="center"> </td>
</tr>
</table>
</center>
</form>

15 réponses

Résumé de la discussion

Problème central : un formulaire HTML hésite entre la vérification JavaScript et l’envoi POST vers envoi_post.php, ce qui bloque soit la validation, soit l’envoi des données. Des réponses identifient des causes fréquentes : deux formulaires sur une même page, des IDs incohérents et une liaison incorrecte entre onsubmit et check_form. D’autres conseils proposent d’unifier le formulaire, de corriger les noms et IDs et de faire pointer l’action vers le même script afin que la validation ne bloque pas l’envoi. Enfin, des suggestions ajoutent une validation côté serveur et des règles simples (format date, e-mail, téléphone) pour éviter les décalages entre front et back.

Bobot (l’IA à votre service)
  1. Contributeur
    Bonjour,

    Logique que cela ne fonctionne pas... les deux formulaires sont indépendants.

    As-tu essayé de tout mettre dans un seul formulaire ?
    1. Pourtant c'est le meme formulaire .
      Enfin je crois puis je te montrer le code en entier tu me diras ce que tu en pense ?
      1. Contributeur
        Moi je vois deux formulaire indépendant... L'un n'envoyant rien vers ta page php et l'autre envoyant tout mais vers rien...

        Tu as essayé comme ceci ?

        <form action="envoi_post.php" method="post" onsubmit="return checkrequired(this)">
        .... Le contenu de ton formulaire....
        </form>
        


        Met ton code en entier.
        1. Voici l'integralité de mon code:
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">

          <head>
          <title>Ced</title>
          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
          </head>

          <script>

          /*Script téléchargé sur EasyScript (www.easy-script.com)*/

          function checkrequired(which){
          var pass=true
          if (document.images){
          for (i=0;i<which.length;i++){
          var tempobj=which.elements[i]
          if (tempobj.name.substring(0,8)=="required"){
          if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
          pass=false
          break
          }
          }
          }
          }
          if (!pass){
          alert("Vous n'avez pas rempli tous les champs obligatoires !!!")
          return false
          }
          else
          return true
          }
          </script>
          <body>

          <form action="envoi_post.php" method="post">
          </form>
          <form onsubmit="return checkrequired(this)">
          <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1033" height="196" background="1.gif" align="center">
          <tr>
          <td width="340" height="196" valign="middle" style="border-style: none; border-width: medium" align="center"> </td>
          <td width="304" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
          <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="341" height="222">
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF">Nom : </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="nom" id="nom" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF">Prénom : </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="prenom" id="prenom" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF">Date de naissance : </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="dtn" id="dtn" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF"><label for="adresse">Adresse</label> :
          </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="adresse" id="complement0" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF"><label for="adresse0">Complément d'adresse</label>
          : </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="complement" id="complement" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF">Code postal : </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="cp" id="cp" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF">Ville : </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="ville" id="ville" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF">Téléphone : </font></td>
          <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
          <input type="text" name="telephone" id="telephone" size="20" /></td>
          </tr>
          <tr>
          <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
          <font color="#FFFFFF">Email : </font></td>
          <td width="170" height="39" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
          <input type="text" name="email" id="email" size="20" /></td>
          </tr>
          </table>
          <p align="center"><input type="submit" value="Envoyer"> onsubmit="return checkrequired(this)">
          </p>
          </td>
          <td width="349" height="196" valign="middle" style="border-style: none; border-width: medium" align="center"> </td>
          </tr>
          </table>
          </center>
          </form>

          </body>

          </html>
          1. Contributeur
            J'avoue être largué...
            Je n'avais jamais vu de formulaire écrit comme ça.
            Tu ouvre et ferme une balise form... cette dernière contient la page de destination mais pas de données à envoyer.
            Puis tu ouvre une nouvelle balise form dans laquelle tu place ton script ainsi que les données que tu envoie.

            Comment sont liés les deux formulaires ? Comment la seconde balise form sait-elle où envoyer les données ?
          2. Tiens voici le code qui fonctionne . Il n' as pas le script en java pour verifier les champs. cela te semble t il correcte

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">

            <head>
            <title>Ced</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            </head>

            <body>

            <form action="envoi_post.php" method="post">

            <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1033" height="196" background="1.gif" align="center">
            <tr>
            <td width="340" height="196" valign="middle" style="border-style: none; border-width: medium" align="center"> </td>
            <td width="304" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
            <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="341" height="222">
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Nom : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="nom" id="nom" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Prénom : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="prenom" id="prenom" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Date de naissance : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="dtn" id="dtn" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF"><label for="adresse">Adresse</label> : </font>
            </td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="adresse" id="complement0" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF"><label for="adresse0">Complément d'adresse</label>
            : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="complement" id="complement" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Code postal : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="cp" id="cp" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Ville : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="ville" id="ville" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Téléphone : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="telephone" id="telephone" size="20" /></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Email : </font></td>
            <td width="170" height="39" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
            <input type="text" name="email" id="email" size="20" /></td>
            </tr>
            </table>
            <p align="center"><input type="submit" value="Envoyer" />
            </td>
            <td width="349" height="196" valign="middle" style="border-style: none; border-width: medium" align="center"> </td>
            </tr>
            </table>
            </center>
            </form>

            </body>

            </html>
          3. Contributeur
            Oui, c'est mieux... Essaie maintenant d'intégrer l'appel de ton script dans ta balise form.
          4. Merci j y travail dur
          5. neiliel, Peux tu maider a rajouter un code pour verifier l adresse mail merci .

            <script>

            /*Script téléchargé sur EasyScript (www.easy-script.com)*/

            function checkrequired(which){
            var pass=true
            if (document.images){
            for (i=0;i<which.length;i++){
            var tempobj=which.elements[i]
            if (tempobj.name.substring(0,8)=="required"){
            if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
            pass=false
            break
            }
            }
            }
            }
            if (!pass){
            alert("Vous n'avez pas rempli tous les champs obligatoires !!!")
            return false
            }
            else
            return true
            }

            function VerifMail()
            {
            a = document.Verif.email.value;
            valide1 = false;

            for(var j=1;j<(a.length);j++){
            if(a.charAt(j)=='@'){
            if(j<(a.length-4)){
            for(var k=j;k<(a.length-2);k++){
            if(a.charAt(k)=='.') valide1=true;
            }
            }
            }
            }
            if(valide1==false) alert("Veuillez saisir une adresse email valide.");
            return valide1;
            }
            </script>
            <body>

            <form action="envoi_post.php" method="post" onsubmit="return checkrequired(this)" onsubmit="return VerifMail();">
        2. voilà une methode:

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
          
          <head>
          <title>Ced</title>
          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
          <script type="text/javascript">
          function check_form(){
          	//verif du nom
          	var nom=document.getElementById('nom');
          	if(nom.value==""){
          		alert("Vous devez remplir le champ nom !");
          		nom.focus(); //on donne le focus au champ nom
          		return false; //ainsi le formulaire ne sera pas posté
          	}
          	//verif prenom
          	var prenom=document.getElementById('prenom');
          	if(prenom.value==""){
          		alert("Vous devez remplir le champ prenom !");
          		prenom.focus(); //on donne le focus au champ prenom
          		return false; //ainsi le formulaire ne sera pas posté
          	}
          	
          	//etc pour tous les champs a tester non vides
          	
          	
          	//et a la fin de la fonction
          	return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
          }
          </script>
          </head>
          
          <body>
          
          <form name="form1" action="envoi_post.php" method="post" onSubmit="return chek_form();" >
          ......................
          
          1. Merci alain votre methode me conviendrai plus mais elle me notifie une erreure en ligne 34 caractere 1.

            Voici mon code :

            <head>
            <title>Ced</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            <script type="text/javascript">
            function check_form(){
            //verif du nom
            var nom=document.getElementById('nom');
            if(nom.value==""){
            alert("Vous devez remplir le champ nom !");
            nom.focus(); //on donne le focus au champ nom
            return false; //ainsi le formulaire ne sera pas posté
            }
            //verif prenom
            var prenom=document.getElementById('prenom');
            if(prenom.value==""){
            alert("Vous devez remplir le champ prenom !");
            prenom.focus(); //on donne le focus au champ prenom
            return false; //ainsi le formulaire ne sera pas posté
            }

            //etc pour tous les champs a tester non vides

            //et a la fin de la fonction
            return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
            }
            </script>
            </head>

            <body>

            <form name="form1" action="envoi_post.php" method="post" onSubmit="return chek_form();" >
            </head>
            <body>

            <form name="form" action="envoi_post.php" method="post" onSubmit="return chek_form();" >

            <div align="center">
            <center>

            <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1024" height="600" background="1.gif">
            <tr>

            <td width="993" height="52" valign="top" style="border-style: none; border-width: medium" align="center">
            <p align="left"><font color="#FFFFFF"><b><u>Veuillez remplir tous les
            champs suivi d'une</u></b>  </font><b><font size="5" color="#FF0000">
            *</font></b></p>
            <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="341" height="222">
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Nom : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="nom" id="nom" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Prénom : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="prenom" id="prenom" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Date de naissance : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="dtn" id="dtn" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF"><label for="adresse">Adresse</label> :
            </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="adresse" id="complement0" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF"><label for="adresse0">Complément d'adresse</label>
            : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="complement" id="complement" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Code postal : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="cp" id="cp" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Ville : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="ville" id="ville" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Téléphone : </font></td>
            <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
            <input type="text" name="telephone" id="telephone" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            <tr>
            <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
            <font color="#FFFFFF">Email : </font></td>
            <td width="170" height="39" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
            <input type="text" name="email" id="email" size="20" /> <b>
            <font size="5" color="#FF0000">*</font></b></td>
            </tr>
            </table>
            <p align="center"><input type="submit" value="Envoyer">
            </p>
            </td>
            </tr>
            </table>
            </center>
            </div>
            </center>
            </form>

            </body>

            </html>
            1. Voir commentaire
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
              <head>
              <title>Ced</title>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
              <script type="text/javascript">
              function check_form(){
              	//verif du nom
              	var nom=document.getElementById('nom');
              	if(nom.value==""){
              		alert("Vous devez remplir le champ nom !");
              		nom.focus(); //on donne le focus au champ nom
              		return false; //ainsi le formulaire ne sera pas posté
              	}
              	//verif prenom
              	var prenom=document.getElementById('prenom');
              	if(prenom.value==""){
              		alert("Vous devez remplir le champ prenom !");
              		prenom.focus(); //on donne le focus au champ prenom
              		return false; //ainsi le formulaire ne sera pas posté
              	}
              	
              	//etc pour tous les champs a tester non vides
              	
              	
              	//et a la fin de la fonction
              	return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
              }
              </script>
              </head>
              
              <body>
              
              <form name="form1" action="envoi_post.php" method="post" onSubmit="return check_form();" >
              <!-- ci dessus il manquait le c à check_form -->
              
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1033" height="196" background="1.gif" align="center">
              <tr>
              <td width="340" height="196" valign="middle" style="border-style: none; border-width: medium" align="center"> </td>
              <td width="304" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
              <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="341" height="222">
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF">Nom : </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="nom" id="nom" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF">Prénom : </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="prenom" id="prenom" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF">Date de naissance : </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="dtn" id="dtn" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF"><label for="adresse">Adresse</label> :
              </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="adresse" id="complement0" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF"><label for="adresse0">Complément d'adresse</label>
              : </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="complement" id="complement" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF">Code postal : </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="cp" id="cp" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF">Ville : </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="ville" id="ville" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF">Téléphone : </font></td>
              <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
              <input type="text" name="telephone" id="telephone" size="20" /></td>
              </tr>
              <tr>
              <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
              <font color="#FFFFFF">Email : </font></td>
              <td width="170" height="39" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
              <input type="text" name="email" id="email" size="20" /></td>
              </tr>
              </table>
              <p align="center"><input type="submit" name="envoyer" value="Envoyer"> 
              </p>
              </td>
              <td width="349" height="196" valign="middle" style="border-style: none; border-width: medium" align="center"> </td>
              </tr>
              </table>
              </center>
              </form>
              
              </body>
              
              </html>
              1. Merci. ca marche peux tu m aider a rajouter une formule pour l'adresse mail soit correcte merci
            2. voilà:

              function check_form(){
              	//verif du nom
              	var nom=document.getElementById('nom');
              	if(nom.value==""){
              		alert("Vous devez remplir le champ nom !");
              		nom.focus(); //on donne le focus au champ nom
              		return false; //ainsi le formulaire ne sera pas posté
              	}
              	//verif prenom
              	var prenom=document.getElementById('prenom');
              	if(prenom.value==""){
              		alert("Vous devez remplir le champ prenom !");
              		prenom.focus(); //on donne le focus au champ prenom
              		return false; //ainsi le formulaire ne sera pas posté
              	}
              	//etc
              	//verif email pas vide et conforme
              	var champ_email=document.getElementById('email');
              	if(champ_email.value==""){
              	alert("Vous devez saisir votre email ! ");
              	champ_email.focus();
              	return false; //on renvoie false et on sort de la fonction
              	}else{
              	//email pas vide on verifie son format
              	var regexp = new RegExp("^[a-zA-Z0-9_\\-\\.]{3,}@[a-zA-Z0-9\\-_]{2,}\\.[a-zA-Z]{2,4}$", "g");
              	if(!regexp.test(champ_email.value) ) {
              	alert("L'adresse e-mail n'est pas valide ! "+champ_email.value);
              	champ_email.focus();
              	return false; //on renvoie false et on sort de la fonction
              	}
              	//etc pour tous les champs a tester non vides
              	
              	
              	//et a la fin de la fonction
              	return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
              }
              1. Merci beaucoup.
                tu es un chef ! gain de temps enorme pour moi.

                En abusant un peu n'aurai tu pas un code pour un masque de saisie pour la date ... :)
              2. Peux tu reverifier ca stp j ai un message d'ereur inattendu :
                Merci

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
                <head>
                <title>Ced</title>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                <script type="text/javascript">
                function check_form(){
                //verif du nom
                var nom=document.getElementById('nom');
                if(nom.value==""){
                alert("Vous devez remplir le champ nom !");
                nom.focus(); //on donne le focus au champ nom
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif prenom
                var prenom=document.getElementById('prenom');
                if(prenom.value==""){
                alert("Vous devez remplir le champ prenom !");
                prenom.focus(); //on donne le focus au champ prenom
                return false; //ainsi le formulaire ne sera pas posté
                }
                //etc
                //verif email pas vide et conforme
                var champ_email=document.getElementById('email');
                if(champ_email.value==""){
                alert("Vous devez saisir votre email ! ");
                champ_email.focus();
                return false; //on renvoie false et on sort de la fonction
                }else{
                //email pas vide on verifie son format
                var regexp = new RegExp("^[a-zA-Z0-9_\\-\\.]{3,}@[a-zA-Z0-9\\-_]{2,}\\.[a-zA-Z]{2,4}$", "g");
                if(!regexp.test(champ_email.value) ) {
                alert("L'adresse e-mail n'est pas valide ! "+champ_email.value);
                champ_email.focus();
                return false; //on renvoie false et on sort de la fonction
                }
                //etc pour tous les champs a tester non vides

                //et a la fin de la fonction
                return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                }
                </script>
                </head>

                <body>

                <form name="form1" action="envoi_post.php" method="post" onSubmit="return check_form();" >
                <!-- ci dessus il manquait le c à check_form -->
            3. inspires toi du test du mail en appliquant cette regex:

              var regexp = new RegExp("^[0-9]{2}-[0-9]{2}-[0-9]{4}$", "g");
              entre les [] les chiffres autorisés, puis entre {} le nombre de chiffres, puis le séparateur par exemple -
              ^ veut dire commence obligatoirement par
              $ veut dire fini obligatoirement par
              1. Bonjour Alain42,
                Peux tu me dire ce qui cloche je vais devenir fou.
                Il me verifie les 3 premiers et a partir de la date de naissance il envoie le formulaire ??

                je te remet le code:

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">

                <head>
                <title>Ced</title>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                <script type="text/javascript">
                function check_form(){
                //verif du nom
                var nom=document.getElementById('nom');
                if(nom.value==""){
                alert("Vous devez remplir le champ Nom !");
                nom.focus(); //on donne le focus au champ nom
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif prenom
                var prenom=document.getElementById('prenom');
                if(prenom.value==""){
                alert("Vous devez remplir le champ Prénom !");
                prenom.focus(); //on donne le focus au champ prenom
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif dtn
                var dtn=document.getElementById('dtn');
                if(dtn.value==""){
                alert("Vous devez remplir le champ Date de naissance !");
                dtn.focus(); //on donne le focus au champ dtn
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif adresse
                var adresse=document.getElementById('adresse');
                if(adresse.value==""){
                alert("Vous devez remplir le champ Adresse !");
                adresse.focus(); //on donne le focus au champ adresse
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif complement
                var complement=document.getElementById('complement');
                if(complement.value==""){
                alert("Vous devez remplir le champ Complement d'adresse !");
                complement.focus(); //on donne le focus au champ complement
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif cp
                var cp=document.getElementById('cp');
                if(cp.value==""){
                alert("Vous devez remplir le champ Code postal !");
                cp.focus(); //on donne le focus au champ cp
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif ville
                var ville=document.getElementById('Ville');
                if(ville.value==""){
                alert("Vous devez remplir le champ Ville !");
                ville.focus(); //on donne le focus au champ ville
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif telephone
                var telephone=document.getElementById('telephone');
                if(telephone.value==""){
                alert("Vous devez remplir le champ Téléphone !");
                telephone.focus(); //on donne le focus au champ telephone
                return false; //ainsi le formulaire ne sera pas posté
                }
                //verif email pas vide et conforme
                var champ_email=document.getElementById('email');
                if(champ_email.value==""){
                alert("Vous devez saisir votre email ! ");
                champ_email.focus();
                return false; //on renvoie false et on sort de la fonction
                }else{
                //email pas vide on verifie son format
                var regexp = new RegExp("^[a-zA-Z0-9_\\-\\.]{3,}@[a-zA-Z0-9\\-_]{2,}\\.[a-zA-Z]{2,4}$", "g");
                if(!regexp.test(champ_email.value) ) {
                alert("L'adresse e-mail n'est pas valide ! "+champ_email.value);
                champ_email.focus();
                return false; //on renvoie false et on sort de la fonction
                }
                //etc pour tous les champs a tester non vides

                //et a la fin de la fonction
                return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                }
                //verif email
                var email=document.getElementById('email');
                if(email.value==""){
                alert("Vous devez remplir le champ email !");
                email.focus(); //on donne le focus au champ email
                return false; //ainsi le formulaire ne sera pas posté
                }
                //etc pour tous les champs a tester non vides

                //et a la fin de la fonction
                return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                }
                </script>
                </head>

                <body>

                <form name="form1" action="camarche/envoi_post.php" method="post" onSubmit="return check_form();">
                <!-- ci dessus il manquait le c à check_form -->
                <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1033" height="196" background="camarche/1.gif" align="center">
                <tr>
                <td width="340" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                </td>
                <td width="304" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="341" height="222">
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF">Nom : </font></td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="nom" id="nom" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF">Prénom : </font></td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="prenom" id="prenom" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF">Date de naissance : </font></td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="dtn" id="dtn" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF"><label for="adresse">Adresse</label> : </font>
                </td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="adresse" id="complement0" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF"><label for="adresse0">Complément d'adresse</label>
                : </font></td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="complement" id="complement" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF">Code postal : </font></td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="cp" id="cp" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF">Ville : </font></td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="ville" id="ville" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF">Téléphone : </font></td>
                <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
                <input type="text" name="telephone" id="telephone" size="20" /></td>
                </tr>
                <tr>
                <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
                <font color="#FFFFFF">Email : </font></td>
                <td width="170" height="39" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
                <input type="text" name="email" id="email" size="20" /></td>
                </tr>
                </table>
                <p align="center"><input type="submit" name="envoyer" value="Envoyer"> </p>
                </td>
                <td width="349" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                </td>
                </tr>
                </table>
                </center>
                </form>

                </body>

                </html>
                1. //verif adresse
                  var adresse=document.getElementById('adresse');


                  et dans ton formulaire tu mets pour Adresse id="complement0"
                  1. Salut alain_42,
                    Je me suis inspirer de ta regex pour verifier tous les champ qui le merite
                    Et j ai un message d'erreur :

                    ligne 125
                    Caractere 1

                    erreur attendu : }

                    Peux tu y jetter ton oeil expert pour me guider

                    <html>

                    <head>

                    <title>Inscription</title>

                    <script type="text/javascript">

                    function check_form(){
                    //verif du nom
                    var nom=document.getElementById('nom');
                    if(nom.value==""){
                    alert("Vous devez remplir le champ nom !");
                    nom.focus(); //on donne le focus au champ nom
                    return false; //ainsi le formulaire ne sera pas posté
                    }
                    //verif prenom
                    var prenom=document.getElementById('prenom');
                    if(prenom.value==""){
                    alert("Vous devez remplir le champ prenom !");
                    prenom.focus(); //on donne le focus au champ prenom
                    return false; //ainsi le formulaire ne sera pas posté
                    }
                    //verif dtn
                    var dtn=document.getElementById('dtn');
                    if(dtn.value==""){
                    alert("Vous devez remplir le champ dtn !");
                    dtn.focus(); //on donne le focus au champ dtn
                    return false; //ainsi le formulaire ne sera pas posté
                    }else{
                    //on verifie son format
                    var regexp = new RegExp("^[0-9]{2}/[0-9]{2}/[0-9]{4}", "g");
                    if(!regexp.test(champ_dtn.value) ) {
                    alert("La date de naissance n'est pas valide ! "+champ_dtn.value);
                    champ_dtn.focus();
                    return false; //on renvoie false et on sort de la fonction
                    }
                    //verif adresse
                    var adresse=document.getElementById('adresse');
                    if(adresse.value==""){
                    alert("Vous devez remplir le champ adresse!");
                    adresse.focus(); //on donne le focus au champ adresse
                    return false; //ainsi le formulaire ne sera pas posté
                    }
                    //verif complement
                    var complement=document.getElementById('complement');
                    if(complement.value==""){
                    alert("Vous devez remplir le champ complement d'adresse !");
                    prenom.focus(); //on donne le focus au champ complement d'adresse
                    return false; //ainsi le formulaire ne sera pas posté
                    }
                    //verif cp
                    var cp=document.getElementById('cp');
                    if(cp.value==""){
                    alert("Vous devez remplir le champ code postal!");
                    cp.focus(); //on donne le focus au champ cp
                    return false; //ainsi le formulaire ne sera pas posté
                    }else{
                    //on verifie son format
                    var regexp = new RegExp("^[0-9]{5}", "g");
                    if(!regexp.test(champ_cp.value) ) {
                    alert("Le code postal n'est pas valide ! "+champ_cp.value);
                    champ_cp.focus();
                    return false; //on renvoie false et on sort de la fonction
                    }
                    //verif ville
                    var ville=document.getElementById('ville');
                    if(ville.value==""){
                    alert("Vous devez remplir le champ ville!");
                    ville.focus(); //on donne le focus au champ ville
                    return false; //ainsi le formulaire ne sera pas posté
                    }
                    //verif telephone
                    var telephone=document.getElementById('telephone');
                    if(telephone.value==""){
                    alert("Vous devez remplir le champ téléphone !");
                    telephone.focus(); //on donne le focus au champ telephone
                    return false; //ainsi le formulaire ne sera pas posté
                    }else{
                    //on verifie son format
                    var regexp = new RegExp("^[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}", "g");
                    if(!regexp.test(champ_cp.value) ) {
                    alert("Le numéro de téléphone n'est pas valide ! "+champ_telephone.value);
                    champ_cp.focus();
                    return false; //on renvoie false et on sort de la fonction
                    }
                    //etc
                    //verif email pas vide et conforme
                    var champ_email=document.getElementById('email');
                    if(champ_email.value==""){
                    alert("Vous devez saisir votre email ! ");
                    champ_email.focus();
                    return false; //on renvoie false et on sort de la fonction
                    }else{
                    //email pas vide on verifie son format
                    var regexp = new RegExp("^[a-zA-Z0-9_\\-\\.]{3,}@[a-zA-Z0-9\\-_]{2,}\\.[a-zA-Z]{2,4}$", "g");
                    if(!regexp.test(champ_email.value) ) {
                    alert("L'adresse e-mail n'est pas valide ! "+champ_email.value);
                    champ_email.focus();
                    return false; //on renvoie false et on sort de la fonction
                    }
                    //etc pour tous les champs a tester non vides

                    //et a la fin de la fonction
                    return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                    }
                    //verif email
                    var email=document.getElementById('email');
                    if(email.value==""){
                    alert("Vous devez remplir le champ email !");
                    prenom.focus(); //on donne le focus au champ email
                    return false; //ainsi le formulaire ne sera pas posté
                    }

                    //etc pour tous les champs a tester non vides

                    //et a la fin de la fonction
                    return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                    }
                    </script>
                    </head>

                    <body>

                    <form name="form1" action="envoi_post.php" method="post" onSubmit="return check_form();">

                    <div align="center">
                    <center>
                    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1024" height="768" background="images/1.gif">
                    <tr>
                    <td width="414" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                    </td>
                    <td width="414" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                     <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="562" height="574">
                    <tr>
                    <td width="560" height="100" align="left" style="border-style: none; border-width: medium" colspan="2">
                     </td>
                    </tr>
                    <tr>
                    <td width="189" height="1" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00">Nom : </font></b></u></td>
                    <td width="371" height="1" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="nom" id="nom" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00">Prénom : </font></b></u></td>
                    <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="prenom" id="prenom" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00">Date de naissance : </font></b></u></td>
                    <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="dtn" id="dtn" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00"><label for="adresse">Adresse</label> :
                    </font></b></u>
                    </td>
                    <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="adresse" id="complement0" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00"><label for="adresse0">Complément d'adresse</label>
                    : </font></b></u></td>
                    <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="complement" id="complement" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00">Code postal : </font></b></u></td>
                    <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="cp" id="cp" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00">Ville : </font></b></u></td>
                    <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="ville" id="ville" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00">Téléphone : </font></b></u></td>
                    <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="telephone" id="telephone" size="50" /></u></b></font></td>
                    </tr>
                    <tr>
                    <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                    <u><b><font color="#DFDF00">Email : </font></b></u></td>
                    <td width="371" height="15" align="left" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
                    <font color="#DFDF00"><b><u>
                    <input type="text" name="email" id="email" size="50" /></u></b></font></td>
                    </tr>
                    </table>
                    <p align="center"><input type="submit" name="envoyer" value="Envoyer"> </p>
                    <p align="center"> </p>
                    <p align="center"> </p>
                    <p align="center"> </p>
                    <p align="center"> </p>
                    </td>
                    <td width="415" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                    </td>
                    </tr>
                    </table>
                    </center>
                    </div>
                    </center>
                    </form>

                    </body>

                    </html>

                    Merci
                    1. il te manquait plein de } pour fermer tous les else

                      et des lignes en trop voir commentaires

                      <html>
                      
                      <head>
                      
                      <title>Inscription</title>
                      
                      
                      <script type="text/javascript">
                      
                      function check_form(){
                      	//verif du nom
                      	var nom=document.getElementById('nom');
                      	if(nom.value==""){
                      	alert("Vous devez remplir le champ nom !");
                      	nom.focus(); //on donne le focus au champ nom
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif prenom
                      	var prenom=document.getElementById('prenom');
                      	if(prenom.value==""){
                      	alert("Vous devez remplir le champ prenom !");
                      	prenom.focus(); //on donne le focus au champ prenom
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif dtn
                      	var dtn=document.getElementById('dtn');
                      	if(dtn.value==""){
                      	alert("Vous devez remplir le champ dtn !");
                      	dtn.focus(); //on donne le focus au champ dtn
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}else{
                      	//on verifie son format
                      		var regexp = new RegExp("^[0-9]{2}/[0-9]{2}/[0-9]{4}", "g");
                      		if(!regexp.test(champ_dtn.value) ) {
                      		alert("La date de naissance n'est pas valide ! "+champ_dtn.value);
                      		champ_dtn.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		}
                      	} //manquait
                      	//verif adresse
                      	var adresse=document.getElementById('adresse');
                      	if(adresse.value==""){
                      	alert("Vous devez remplir le champ adresse!");
                      	adresse.focus(); //on donne le focus au champ adresse
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif complement
                      	var complement=document.getElementById('complement');
                      	if(complement.value==""){
                      	alert("Vous devez remplir le champ complement d'adresse !");
                      	prenom.focus(); //on donne le focus au champ complement d'adresse
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif cp
                      	var cp=document.getElementById('cp');
                      	if(cp.value==""){
                      	alert("Vous devez remplir le champ code postal!");
                      	cp.focus(); //on donne le focus au champ cp
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}else{
                      	//on verifie son format
                      	var regexp = new RegExp("^[0-9]{5}", "g");
                      		if(!regexp.test(champ_cp.value) ) {
                      		alert("Le code postal n'est pas valide ! "+champ_cp.value);
                      		champ_cp.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		}
                      	} //manquait
                      	//verif ville
                      	var ville=document.getElementById('ville');
                      	if(ville.value==""){
                      	alert("Vous devez remplir le champ ville!");
                      	ville.focus(); //on donne le focus au champ ville
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif telephone
                      	var telephone=document.getElementById('telephone');
                      	if(telephone.value==""){
                      	alert("Vous devez remplir le champ téléphone !");
                      	telephone.focus(); //on donne le focus au champ telephone
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}else{
                      	//on verifie son format
                      		var regexp = new RegExp("^[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}", "g");
                      		if(!regexp.test(champ_cp.value) ) {
                      		alert("Le numéro de téléphone n'est pas valide ! "+champ_telephone.value);
                      		champ_cp.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		}
                      	} //manquait
                      	//etc
                      	//verif email pas vide et conforme
                      	var champ_email=document.getElementById('email');
                      	if(champ_email.value==""){
                      	alert("Vous devez saisir votre email ! ");
                      	champ_email.focus();
                      	return false; //on renvoie false et on sort de la fonction
                      	}else{
                      		//email pas vide on verifie son format
                      		var regexp = new RegExp("^[a-zA-Z0-9_\\-\\.]{3,}@[a-zA-Z0-9\\-_]{2,}\\.[a-zA-Z]{2,4}$", "g");
                      		if(!regexp.test(champ_email.value) ) {
                      		alert("L'adresse e-mail n'est pas valide ! "+champ_email.value);
                      		champ_email.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		
                      		}
                      	} //manquait
                      
                      	///////////////// toute cette partie la en trop:
                      	/*
                      	//et a la fin de la fonction
                      	return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                      	}
                      	*/
                      	////////////////////////
                      	//verif email
                      	var email=document.getElementById('email');
                      	if(email.value==""){
                      	alert("Vous devez remplir le champ email !");
                      	prenom.focus(); //on donne le focus au champ email
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      
                      	//etc pour tous les champs a tester non vides
                      
                      
                      	//et a la fin de la fonction
                      	return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                      }
                      </script>
                      1. Pour le champ dtn, jai un message d erreur :
                        Ligne 36
                        Caractere 3
                        erreur champ_dtn est defini

                        J ai comparer avec la regex du mail qui fonctionne et elle est identique Je ne comprend pas pourquoi ca coince ?
                      2. En plus ca m envoie le formulaire a partir de dtn .

                        Je comprend pas .
                    2. des erreurs et tu n'avait pas changé id="complemnt0" => id="adresse"

                      ensuite je ne suis pas convaincu par le format du n° téléphone 01-02-03-04-05 ???

                      <html>
                      
                      <head>
                      
                      <title>Inscription</title>
                      
                      
                      <script type="text/javascript">
                      
                      function check_form(){
                      	//verif du nom
                      	var nom=document.getElementById('nom');
                      	if(nom.value==""){
                      	alert("Vous devez remplir le champ nom !");
                      	nom.focus(); //on donne le focus au champ nom
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif prenom
                      	var prenom=document.getElementById('prenom');
                      	if(prenom.value==""){
                      	alert("Vous devez remplir le champ prenom !");
                      	prenom.focus(); //on donne le focus au champ prenom
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif dtn
                      	var dtn=document.getElementById('dtn');
                      	if(dtn.value==""){
                      	alert("Vous devez remplir le champ dtn !");
                      	dtn.focus(); //on donne le focus au champ dtn
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}else{
                      	//on verifie son format
                      		var regexp = new RegExp("^[0-9]{2}/[0-9]{2}/[0-9]{4}", "g");
                      		if(!regexp.test(dtn.value) ) {
                      		alert("La date de naissance n'est pas valide ! "+dtn.value);
                      		dtn.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		}
                      	} //manquait
                      	//verif adresse
                      	var adresse=document.getElementById('adresse');
                      	if(adresse.value==""){
                      	alert("Vous devez remplir le champ adresse!");
                      	adresse.focus(); //on donne le focus au champ adresse
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif complement
                      	var complement=document.getElementById('complement');
                      	if(complement.value==""){
                      	alert("Vous devez remplir le champ complement d'adresse !");
                      	prenom.focus(); //on donne le focus au champ complement d'adresse
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif cp
                      	var cp=document.getElementById('cp');
                      	if(cp.value==""){
                      	alert("Vous devez remplir le champ code postal!");
                      	cp.focus(); //on donne le focus au champ cp
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}else{
                      	//on verifie son format
                      	var regexp = new RegExp("^[0-9]{5}", "g");
                      		if(!regexp.test(cp.value) ) {
                      		alert("Le code postal n'est pas valide ! "+cp.value);
                      		cp.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		}
                      	} //manquait
                      	//verif ville
                      	var ville=document.getElementById('ville');
                      	if(ville.value==""){
                      	alert("Vous devez remplir le champ ville!");
                      	ville.focus(); //on donne le focus au champ ville
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}
                      	//verif telephone
                      	var telephone=document.getElementById('telephone');
                      	if(telephone.value==""){
                      	alert("Vous devez remplir le champ téléphone !");
                      	telephone.focus(); //on donne le focus au champ telephone
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}else{
                      	//on verifie son format
                      		var regexp = new RegExp("^[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}", "g");
                      		if(!regexp.test(telephone.value) ) {
                      		alert("Le numéro de téléphone n'est pas valide ! "+telephone.value);
                      		telephone.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		}
                      	} //manquait
                      	//etc
                      	//verif email pas vide et conforme
                      	var champ_email=document.getElementById('email');
                      	if(champ_email.value==""){
                      	alert("Vous devez saisir votre email ! ");
                      	champ_email.focus();
                      	return false; //on renvoie false et on sort de la fonction
                      	}else{
                      		//email pas vide on verifie son format
                      		var regexp = new RegExp("^[a-zA-Z0-9_\\-\\.]{3,}@[a-zA-Z0-9\\-_]{2,}\\.[a-zA-Z]{2,4}$", "g");
                      		if(!regexp.test(champ_email.value) ) {
                      		alert("L'adresse e-mail n'est pas valide ! "+champ_email.value);
                      		champ_email.focus();
                      		return false; //on renvoie false et on sort de la fonction
                      		
                      		}
                      	} //manquait
                      
                      	///////////////// toute cette partie la en trop:
                      	/*
                      	//et a la fin de la fonction
                      	return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                      	}
                      	
                      	//verif email  //pourquoi ,deux fois
                      	var email=document.getElementById('email');
                      	if(email.value==""){
                      	alert("Vous devez remplir le champ email !");
                      	prenom.focus(); //on donne le focus au champ email
                      	return false; //ainsi le formulaire ne sera pas posté
                      	}*/
                      ////////////////////////
                      	//etc pour tous les champs a tester non vides
                      
                      
                      	//et a la fin de la fonction
                      	return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
                      }
                      </script>
                      </head>
                      
                      <body>
                      
                      
                      <form name="form1" action="envoi_post.php" method="post" onSubmit="return check_form();">
                      
                      <div align="center">
                      <center>
                      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1024" height="768" background="images/1.gif">
                      <tr>
                      <td width="414" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                      </td>
                      <td width="414" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                       <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="562" height="574">
                      <tr>
                      <td width="560" height="100" align="left" style="border-style: none; border-width: medium" colspan="2">
                       </td>
                      </tr>
                      <tr>
                      <td width="189" height="1" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00">Nom : </font></b></u></td>
                      <td width="371" height="1" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="nom" id="nom" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00">Prénom : </font></b></u></td>
                      <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="prenom" id="prenom" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00">Date de naissance : </font></b></u></td>
                      <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="dtn" id="dtn" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00"><label for="adresse">Adresse</label> :
                      </font></b></u>
                      </td>
                      <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="adresse" id="adresse" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00"><label for="adresse0">Complément d'adresse</label>
                      : </font></b></u></td>
                      <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="complement" id="complement" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00">Code postal : </font></b></u></td>
                      <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="cp" id="cp" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00">Ville : </font></b></u></td>
                      <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="ville" id="ville" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00">Téléphone : </font></b></u></td>
                      <td width="371" height="15" align="left" style="border-style: none; border-width: medium">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="telephone" id="telephone" size="50" /></u></b></font></td>
                      </tr>
                      <tr>
                      <td width="189" height="15" align="left" style="border-style: none; border-width: medium">
                      <u><b><font color="#DFDF00">Email : </font></b></u></td>
                      <td width="371" height="15" align="left" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
                      <font color="#DFDF00"><b><u>
                      <input type="text" name="email" id="email" size="50" /></u></b></font></td>
                      </tr>
                      </table>
                      <p align="center"><input type="submit" name="envoyer" value="Envoyer"> </p>
                      <p align="center"> </p>
                      <p align="center"> </p>
                      <p align="center"> </p>
                      <p align="center"> </p>
                      </td>
                      <td width="415" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
                      </td>
                      </tr>
                      </table>
                      </center>
                      </div>
                      </center>
                      </form>
                      
                      </body>
                      
                      </html> 
                      1. Merci alain de toute ton aide plus que precieuse et de ta patience.