Partage
  • Partager sur Facebook
  • Partager sur Twitter

Probleme verification des champ

Sujet résolu
    27 août 2010 à 12:03:00

    Serait il possible que quelqu un jette un coup doeil a mon script et maide pour le corriger.

    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>Mini-chat</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script language="JavaScript">function verifSelection() {if (document.mail_form.nom.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.Prenom.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ3.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ4.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ5.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ6.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ7.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ8.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ9.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.champ10.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    } if (document.mail_form.zone_email.value == "") {
    alert("VEUILLEZ REMPLIR TOUS LES CHAMPS.")
    return false
    }

    invalidChars = " /:,;'"

    for (i=0; i<invalidChars.length; i++) { // does it contain any invalid characters?
    badChar = invalidChars.charAt(i)

    if (document.mail_form.zone_email.value.indexOf(badChar,0) > -1) {
    alert("Votre adresse e-mail contient des caractères invalides. Veuillez vérifier.")
    document.mail_form.zone_email.focus()
    return false
    }
    }

    atPos = document.mail_form.zone_email.value.indexOf("@",1) // there must be one "@" symbol
    if (atPos == -1) {
    alert('Votre adresse e-mail ne contient pas le signe "@". Veuillez vérifier.')
    document.mail_form.zone_email.focus()
    return false
    }

    if (document.mail_form.zone_email.value.indexOf("@",atPos+1) != -1) { // and only one "@" symbol
    alert('Il ne doit y avoir qu\'un signe "@". Veuillez vérifier.')
    document.mail_form.zone_email.focus()
    return false
    }

    periodPos = document.mail_form.zone_email.value.indexOf(".",atPos)

    if (periodPos == -1) { // and at least one "." after the "@"
    alert('Vous avez oublié le point "." après le signe "@". Veuillez vérifier.')
    document.mail_form.zone_email.focus()
    return false
    }

    if (periodPos+3 > document.mail_form.zone_email.value.length) { // must be at least 2 characters after the
    alert('Il doit y avoir au moins deux caractères après le signe ".". Veuillez vérifier.')
    document.mail_form.zone_email.focus()
    return false
    }} // Fin de la fonction

    </script>
    </head>
    <style type="text/css">
    form
    {
    text-align:center;
    }
    </style>
    <body>

    <form action="envoi_post.php" method="post" onSubmit="return verifSelection()">
    <center>
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1024" height="196" background="1.gif">
    <tr>
    <td width="340" height="196" valign="middle" style="border-style: none; border-width: medium">&nbsp;</td>
    <td width="304" height="196" valign="middle" style="border-style: none; border-width: medium">
    <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="38" align="left" style="border-style: none; border-width: medium">
    <font color="#FFFFFF">Numéro : </font> </td>
    <td width="170" height="38" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top: medium none #111111; border-bottom-style: none; border-bottom-width: medium">
    <!--webbot bot="Validation" s-data-type="String" s-allow-other-chars="@" --><input type="text" name="numero" id="numero" size="20" /></td>
    </tr>
    <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="340" height="196" valign="middle" style="border-style: none; border-width: medium">&nbsp;</td>
    </tr>
    </table>
    </center>
    </form>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    • Partager sur Facebook
    • Partager sur Twitter

    Probleme verification des champ

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown