IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

[Formulaire] Champs obligatoires et non obligatoires [Fait]


Sujet :

JavaScript

  1. #1
    Membre éprouvé Avatar de FraK
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2005
    Messages
    828
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2005
    Messages : 828
    Points : 985
    Points
    985
    Par défaut [Formulaire] Champs obligatoires et non obligatoires
    voila
    sur mon formulaire
    j'ai un petit soucis
    pour les champs obligatoires ca c'est ok
    mais je voudrai que certains ne le soient pas
    et la ...
    mon cerveau fond, je vois pas quoi faire
    une petit coup de paluche ?

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    <html>
    <head>
    <title>blabla</title>
    <SCRIPT LANGUAGE="JavaScript">
     
    function VerifForm(formulaire)
        {
        adresse = formulaire.email.value;
        var place = adresse.indexOf("@",1);
        var point = adresse.indexOf(".",place+1);
        if ((place > -1)&&(adresse.length >2)&&(point > 1))
            {
            formulaire.submit();
            return(true);
            }
        else
            {
            alert('Veuillez inserer une adresse E-mail valide !\nSi votre E-mail est incorrecte, vous ne recevrez pas de réponse.');
            return(false);
            }
        }
    </SCRIPT>
    <script type="text/javascript">
     
     
    //    Si la variable suivante est à true, les mots interdits sont remplacés par des étoiles.
    //    Sinon, il sont effacés.
    var RemplacementEtoiles = true;
     
    //    Nombre de caractères maximum du textarea
    var Nombre_Caracteres_Maximum = 1000000000;
     
    //    Nombre de caractères minimimal à partir duquel il n'y a plus de doute :
    //    Le mot qui est scanné est bien un mot interdit.
    //    Valeur par défaut : 4
    //    EXEMPLE :
    //        Mettez le mot 'con' dans le tableau des mots interdits.
    //        Tapez le mot conSpiration.
    //        Mettez le curseur du textarea juste avant le S.
    //        Tapez un espace. ===> le mot 'con' est remplacé.
    //        Si vous mettez la variable suivante à 3, et que vous recommencez l'opération, vous ne pourrez pas taper le mot conspiration.
    var Constante_Doute = 4;
     
    </script>
     
    <script type="text/javascript" src="limitation.js"></script>
    </head>
    <body bgcolor="#FFFFFF">
    <center>
    <form method="post" action="ok.php" onSubmit="return(VerifForm(this))">
    <p>    
    </p>
    <table width="44%" border="0">
      <tr>
        <td width="51%"><div align="right">Soci&eacute;t&eacute; : 
              <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="societe" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
        <td width="49%">  <div align="right">Nom :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="nom" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></div></td>
      </tr>
      <tr>
        <td><div align="right">Adresse :
     
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="adresse" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
        <td> <div align="right">T&eacute;l&eacute;phone :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="tel" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
      </tr>
      <tr>
        <td> <div align="right">Code postal :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="cp" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
        <td>  <div align="right">Fax :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="fax" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"> 
        </div></td>
      </tr>
      <tr>
        <td> <div align="right">Ville :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="ville" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">    
        </div></td>
        <td>  <div align="right">Email :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="email" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"> 
        </div></td>
      </tr>
    </table>
    <p><br>
      </p>
     
    <table width="48%" border="0">
      <tr>
        <th width="60%" scope="col">R&eacute;f&eacute;rence</th>
        <th width="13%" scope="col">Quantit&eacute; </th>
        <th width="14%" scope="col">Avec visuel </th>
        <th width="13%" scope="col">Sans visuel</th>
      </tr>
      <tr>
        <th scope="col">          <input type="text" name="ref1" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte1" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu1" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu1" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref2" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte2" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu2" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu2" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref3" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte3" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu3" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu3" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref4" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte4" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu4" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu4" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref5" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte5" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu5" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu5" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref6" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte6" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
      <th scope="col"><INPUT TYPE="radio" NAME="visu6" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu6" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text" name="ref7" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte7" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu7" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu7" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref8" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte8" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
      <th scope="col"><INPUT TYPE="radio" NAME="visu8" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu8" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref9" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte9" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu9" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu9" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref10" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte10" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu10" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu10" VALUE="sans visuel"> Non </th>
      </tr>
    </table>
    <p><br>
     
      <br>
      <br>
     
      <br>
      <br>
     
      <br>
      <br>
    </p>
    <p>
      <input type="submit" name="Submit" value="Envoyer" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
      <input type="reset" name="Reset" value="Effacer" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
     
    </form>
    <br><br><br>
    </center>
    </body>
    </html>
    je voudrai que tout ce qui est saisie d'infos de l'utilisateur = obligatoire
    et tout ce qui est commande en dessous (reference, quantité, etc ...)
    meme si c'est blanc, ca valide
    Infographiste / Webdesigner / Intégrateur (un peu Développeur aussi si on peut dire ;p)
    On me trouve souvent dans la partie Hardware, Systèmes et Logiciels ou encore Webmasters - Développement Web et surtout dans le forum Wordpress.
    »» Mon Blog Musical (drumnbass)

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    135
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 135
    Points : 139
    Points
    139
    Par défaut
    Je ne vois pas trop ce qui fait le contrôle de saisie dans ton code.

    Lorsque tu valides ton formulaire, cela lance la fonction javascript VerifForm qui ne vérifie que l'email. Pour le reste, ça ne fait rien...

  3. #3
    Membre éprouvé Avatar de FraK
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2005
    Messages
    828
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2005
    Messages : 828
    Points : 985
    Points
    985
    Par défaut
    mmmmhhh
    pour ca ok
    bon effectivement je vais compléter mon code, enfin mes pages

    l'ensemble est composé de 4 applets

    -> OK.PHP
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    <?php include("config.php"); ?>
    <?php
    // si les champs sont remplis
     
    if(!empty($_REQUEST['societe']) && !empty($_REQUEST['nom']) && !empty($_REQUEST['adresse']) && !empty($_REQUEST['activite']) && !empty($_REQUEST['cp']) && !empty($_REQUEST['ville']) && !empty($_REQUEST['tel']) && !empty($_REQUEST['fax']) && !empty($_REQUEST['email'])&& !empty($_REQUEST['ref1']) && !empty($_REQUEST['qte1']) && !empty($_REQUEST['visu1']) && !empty($_REQUEST['ref2']) && !empty($_REQUEST['qte2']) && !empty($_REQUEST['visu2']) && !empty($_REQUEST['ref3']) && !empty($_REQUEST['qte3']) && !empty($_REQUEST['visu3']) && !empty($_REQUEST['ref4']) && !empty($_REQUEST['qte4']) && !empty($_REQUEST['visu4']) && !empty($_REQUEST['ref5']) && !empty($_REQUEST['qte5']) && !empty($_REQUEST['visu5']) && !empty($_REQUEST['ref6']) && !empty($_REQUEST['qte6']) && !empty($_REQUEST['visu6']) && !empty($_REQUEST['ref7']) && !empty($_REQUEST['qte7']) && !empty($_REQUEST['visu7']) && !empty($_REQUEST['ref8']) && !empty($_REQUEST['qte8']) && !empty($_REQUEST['visu8']) && !empty($_REQUEST['ref9']) && !empty($_REQUEST['qte9']) && !empty($_REQUEST['visu9']) && !empty($_REQUEST['ref10']) && !empty($_REQUEST['qte10']) && !empty($_REQUEST['visu10'])){ 
      echo'
    <html>
    <head>
    <title>*****</title>
    </head>
    <body bgcolor="#FFFFFF">
    <center>Merci ', htmlentities($_REQUEST['societe']),',<br><br>Votre message nous a bien été envoyé.<br>Voici les informations que vous avez entré :<br><br>
    <b>Sujet du mail :</b> Demande de tarifs <br>
    <b>Votre société :</b> '. htmlentities($_REQUEST['societe']).'<br>
    <b>Votre adresse :</b> '. htmlentities($_REQUEST['adresse']).'<br>
    <b>Votre code postal :</b> '. htmlentities($_REQUEST['cp']).'<br>
    <b>Votre ville :</b>'. htmlentities($_REQUEST['ville']).'<br>
    <b>Votre nom :</b> '. htmlentities($_REQUEST['nom']).'<br>
    <b>Votre numéro de téléphone :</b> '. htmlentities($_REQUEST['tel']).'<br>
    <b>Votre numéro de fax :</b> '. htmlentities($_REQUEST['fax']).'<br>
    <b>Votre demande de devis :</b><br> Produit : '. htmlentities($_REQUEST['ref1']).' - Quantité : '. htmlentities($_REQUEST['qte1']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu1']).'<br>
    Produit : '. htmlentities($_REQUEST['ref2']).' - Quantité : '. htmlentities($_REQUEST['qte2']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu2']).'<br>
    Produit : '. htmlentities($_REQUEST['ref3']).' - Quantité : '. htmlentities($_REQUEST['qte3']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu3']).'<br>
    Produit : '. htmlentities($_REQUEST['ref4']).' - Quantité : '. htmlentities($_REQUEST['qte4']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu4']).'<br>
    Produit : '. htmlentities($_REQUEST['ref5']).' - Quantité : '. htmlentities($_REQUEST['qte5']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu5']).'<br>
    Produit : '. htmlentities($_REQUEST['ref6']).' - Quantité : '. htmlentities($_REQUEST['qte6']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu6']).'<br>
    Produit : '. htmlentities($_REQUEST['ref7']).' - Quantité : '. htmlentities($_REQUEST['qte7']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu7']).'<br>
    Produit : '. htmlentities($_REQUEST['ref8']).' - Quantité : '. htmlentities($_REQUEST['qte8']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu8']).'<br>
    Produit : '. htmlentities($_REQUEST['ref9']).' - Quantité : '. htmlentities($_REQUEST['qte9']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu9']).'<br>
    Produit : '. htmlentities($_REQUEST['ref10']).' - Quantité : '. htmlentities($_REQUEST['qte10']).' - Avec ou sans visuel : '. htmlentities($_REQUEST['visu10']).'<br>
     
    <b>Votre adresse email :</b>'. htmlentities($_REQUEST['email']).'<br>
    <br>
    
    <br><br>Vous allez recevoir une E-mail de confirmation.<br>Après ceci, nous vous répondrons dans les plus bref délais.<br><br>A très bientôt ...
    <br><br><br><font size="2"></font></center>
    </body>
    </html>
      ';
    }else{
      echo '
    <html>
    <head>
    <title>Erreur, formulaire pas envoyé</title>
    </head>
    <body bgcolor="#FFFFFF">
    <center>
    Désolé, une erreur est survenue.<br>Vous devez remplir correctement tous les champs !<br><br><br> [ <a href="#" onClick="history.back()">Retour</a> ]
    <br><br><br><font size="2"></a></font>
    </body>
    </html>
      ';
    }
    ?>
    -> CONFIG.PHP
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    <?php
    // DEBUT DE LA CONFIGURATION
    $prenomw = ("*****"); // Votre Prénom
    $sitew =("http://www.*****.fr"); // Url de votre site
    $emailw  = "info@*****.fr";
    $sujet = "Demande de tarifs";
    // FIN DE LA CONFIGURATION
    ?>
    <?
    // NE MODIFIEZ PAS CE QUI SUIT ! LE SCRIPT POURRAIT NE PAS FONCTIONNER !
    mail(
    "$emailw",
    "$sujet",
    "Demande de devis sur $prenomw,\n.\nVoici les informations de l'internaute :\n\nSociété : $societe\nNom : $nom\nAdresse : $adresse\nCode postal : $cp\nVille : $ville\nTéléphone : $tel\n Fax : $fax\nEmail : $email\n\n------ DEVIS ------\n\nProduit : $ref1 +++ Quantité : $qte1 +++ Visuel : $visu1\nProduit : $ref2 +++ Quantité : $qte2 +++ Visuel : $visu2\nProduit : $ref3 +++ Quantité : $qte3 +++ Visuel : $visu3\nProduit : $ref4 +++ Quantité : $qte4 +++ Visuel : $visu4\nProduit : $ref5 +++ Quantité : $qte5 +++ Visuel : $visu5\nProduit : $ref6 +++ Quantité : $qte6 +++ Visuel : $visu6\nProduit : $ref7 +++ Quantité : $qte7 +++ Visuel : $visu7\nProduit : $ref8 +++ Quantité : $qte8 +++ Visuel : $visu8\nProduit : $ref9 +++ Quantité : $qte9 +++ Visuel : $visu9\nProduit : $ref10 +++ Quantité : $qte10 +++ Visuel : $visu10\n");
    ?>
    <?
    // NE MODIFIEZ PAS CE QUI SUIT ! LE SCRIPT POURRAIT NE PAS FONCTIONNER ! 
    mail(
    "$email",
    "$sujet",
    "Vous recevez ce message car vous nous avez rempli le formulaire de demande de tarifs de : $sitew.\n\n\nSociété : $societe\nNom : $nom\nAdresse : $adresse\nCode postal : $cp\nVille : $ville\nTéléphone : $tel\n Fax : $fax\nEmail : $email\n\n------ DEVIS ------\n\nProduit : $ref1 +++ Quantité : $qte1 +++ Visuel : $visu1\nProduit : $ref2 +++ Quantité : $qte2 +++ Visuel : $visu2\nProduit : $ref3 +++ Quantité : $qte3 +++ Visuel : $visu3\nProduit : $ref4 +++ Quantité : $qte4 +++ Visuel : $visu4\nProduit : $ref5 +++ Quantité : $qte5 +++ Visuel : $visu5\nProduit : $ref6 +++ Quantité : $qte6 +++ Visuel : $visu6\nProduit : $ref7 +++ Quantité : $qte7 +++ Visuel : $visu7\nProduit : $ref8 +++ Quantité : $qte8 +++ Visuel : $visu8\nProduit : $ref9 +++ Quantité : $qte9 +++ Visuel : $visu9\nProduit : $ref10 +++ Quantité : $qte10 +++ Visuel : $visu10\n\n\n");
    ?>
    -> LIMITATION.JS
    Code js : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    var StrLen;
    var Contenu;
     
    Constante_Doute--;
     
    function Etoiles(nb)    {
        v = '';
        j=0;
        while(j<nb)    {
            v += '*';
            j++;
        }
        if(!RemplacementEtoiles) v = '';
        return v;
    }
     
    function ReInit(valeur, nb, bool)    {
        if(bool == undefined)    bool = false;
        v = Etoiles(nb);
        espace = (RemplacementEtoiles) ? ' ' : '';
        Contenu = (! bool ) ? (valeur + v) : (v + espace + valeur);
        StrLen = Contenu.length;
    }
     
    function Compter(Target, compteur) {
        ReInit(Target.value, -1);
        for(i=0; i<mots_interdits.length; i++)    {
            reg = new RegExp(' '+mots_interdits[i]+' ', 'gi');
            v = ' '+Etoiles(mots_interdits[i].length)+' ';
     
            if((!RemplacementEtoiles)&&(i==0)) v += ' ';
            ReInit(Contenu.replace(reg, v), -1);
     
            if(Contenu.substring(0, mots_interdits[i].length+1).toLowerCase() == mots_interdits[i].toLowerCase()+' ')
                ReInit(Contenu.substring(mots_interdits[i].length+1, StrLen), mots_interdits[i].length, true);
     
            if((Contenu.substring(StrLen-mots_interdits[i].length, StrLen).toLowerCase() == mots_interdits[i].toLowerCase()) && (mots_interdits[i].length>Constante_Doute))
                ReInit(Contenu.substring(0, StrLen-mots_interdits[i].length), mots_interdits[i].length);
     
        }
        if (StrLen > Nombre_Caracteres_Maximum ) {
            Erreur = false;
            for(i=0; i<mots_interdits.length; i++)    {
                if(Contenu.substring(StrLen-mots_interdits[i].length, StrLen).toLowerCase() == mots_interdits[i].toLowerCase())    {
                    ReInit(Contenu.substring(0, StrLen-mots_interdits[i].length), mots_interdits[i].length, true);
                    Erreur = true;
                }
            }
            if(!Erreur)    ReInit(Contenu.substring(0,Nombre_Caracteres_Maximum), -1);
        }
        Target.value = Contenu;
        compteur.value = Nombre_Caracteres_Maximum-StrLen;
    }

    -> INDEX.PHP
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    <html>
    <head>
    <title>*****</title>
    <SCRIPT LANGUAGE="JavaScript">
     
    function VerifForm(formulaire)
        {
        adresse = formulaire.email.value;
        var place = adresse.indexOf("@",1);
        var point = adresse.indexOf(".",place+1);
        if ((place > -1)&&(adresse.length >2)&&(point > 1))
            {
            formulaire.submit();
            return(true);
            }
        else
            {
            alert('Veuillez inserer une adresse E-mail valide !\nSi votre E-mail est incorrecte, vous ne recevrez pas de réponse.');
            return(false);
            }
        }
    </SCRIPT>
    <script type="text/javascript">
     
     
    //    Si la variable suivante est à true, les mots interdits sont remplacés par des étoiles.
    //    Sinon, il sont effacés.
    var RemplacementEtoiles = true;
     
    //    Nombre de caractères maximum du textarea
    var Nombre_Caracteres_Maximum = 1000000000;
     
    //    Nombre de caractères minimimal à partir duquel il n'y a plus de doute :
    //    Le mot qui est scanné est bien un mot interdit.
    //    Valeur par défaut : 4
    //    EXEMPLE :
    //        Mettez le mot 'con' dans le tableau des mots interdits.
    //        Tapez le mot conSpiration.
    //        Mettez le curseur du textarea juste avant le S.
    //        Tapez un espace. ===> le mot 'con' est remplacé.
    //        Si vous mettez la variable suivante à 3, et que vous recommencez l'opération, vous ne pourrez pas taper le mot conspiration.
    var Constante_Doute = 4;
     
    </script>
     
    <script type="text/javascript" src="limitation.js"></script>
    </head>
    <body bgcolor="#FFFFFF">
    <center>
    <form method="post" action="ok.php" onSubmit="return(VerifForm(this))">
    <p>    
    </p>
    <table width="44%" border="0">
      <tr>
        <td width="51%"><div align="right">Soci&eacute;t&eacute; : 
              <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="societe" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
        <td width="49%">  <div align="right">Nom :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="nom" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></div></td>
      </tr>
      <tr>
        <td><div align="right">Adresse :
     
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="adresse" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
        <td> <div align="right">T&eacute;l&eacute;phone :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="tel" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
      </tr>
      <tr>
        <td> <div align="right">Code postal :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="cp" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
        </div></td>
        <td>  <div align="right">Fax :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="fax" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"> 
        </div></td>
      </tr>
      <tr>
        <td> <div align="right">Ville :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="ville" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">    
        </div></td>
        <td>  <div align="right">Email :
            <input type="text" onKeyUp="Compter(this, this.form.CharRestant);" name="email" size="20" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"> 
        </div></td>
      </tr>
    </table>
    <p><br>
      </p>
     
    <table width="48%" border="0">
      <tr>
        <th width="60%" scope="col">R&eacute;f&eacute;rence</th>
        <th width="13%" scope="col">Quantit&eacute; </th>
        <th width="14%" scope="col">Avec visuel </th>
        <th width="13%" scope="col">Sans visuel</th>
      </tr>
      <tr>
        <th scope="col">          <input type="text" name="ref1" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte1" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu1" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu1" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref2" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte2" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu2" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu2" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref3" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte3" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu3" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu3" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref4" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte4" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu4" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu4" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref5" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte5" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu5" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu5" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref6" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte6" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
      <th scope="col"><INPUT TYPE="radio" NAME="visu6" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu6" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text" name="ref7" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte7" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu7" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu7" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref8" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte8" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
      <th scope="col"><INPUT TYPE="radio" NAME="visu8" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu8" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref9" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte9" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu9" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu9" VALUE="sans visuel"> Non </th>
      </tr>
      <tr>
        <th scope="col"><input type="text"  name="ref10" size="50" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
        <th scope="col"><input type="text"  name="qte10" size="10" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;"></th>
    <th scope="col"><INPUT TYPE="radio" NAME="visu10" VALUE="avec visuel"> Oui </th>
        <th scope="col"><INPUT TYPE="radio" NAME="visu10" VALUE="sans visuel"> Non </th>
      </tr>
    </table>
    <p><br>
     
      <br>
      <br>
     
      <br>
      <br>
     
      <br>
      <br>
    </p>
    <p>
      <input type="submit" name="Submit" value="Envoyer" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
      <input type="reset" name="Reset" value="Effacer" style="Border-Color: #A1B3B9; Border-Style: dashed; Border-Width: 2px;background-color: #c2d2d7;">
     
    </form>
    <br><br><br>
    </center>
    </body>
    </html>
    voila tout est la maintenant, et dans l'état ou je me trouve
    j'arrive vraiment pas à voir d'ou ca peut venir
    Infographiste / Webdesigner / Intégrateur (un peu Développeur aussi si on peut dire ;p)
    On me trouve souvent dans la partie Hardware, Systèmes et Logiciels ou encore Webmasters - Développement Web et surtout dans le forum Wordpress.
    »» Mon Blog Musical (drumnbass)

  4. #4
    Membre habitué
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    135
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 135
    Points : 139
    Points
    139
    Par défaut
    Il faudrait que tu modifies ton script VerifForm pour tester l'existence des champs que tu souhaites et faire la même chose dans ton script coté serveur (je n'ai pas trop regarder ton script php, parce que je ne m'y connais pas trop et que ce n'est pas le forum pour ça).

  5. #5
    Membre éprouvé Avatar de FraK
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2005
    Messages
    828
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2005
    Messages : 828
    Points : 985
    Points
    985
    Par défaut
    c'est sur
    mais bon
    je vais pas poster dans 3 forums a cause de 3 lannguages utilisés pour 1 seul probleme ^^
    je vais tester ton truc voir
    thx
    Infographiste / Webdesigner / Intégrateur (un peu Développeur aussi si on peut dire ;p)
    On me trouve souvent dans la partie Hardware, Systèmes et Logiciels ou encore Webmasters - Développement Web et surtout dans le forum Wordpress.
    »» Mon Blog Musical (drumnbass)

  6. #6
    Membre éprouvé Avatar de FraK
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2005
    Messages
    828
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2005
    Messages : 828
    Points : 985
    Points
    985
    Par défaut
    erf
    je bloque toujours
    mon cerveau a fondu par moitié deja telment je lui demande un effort ^^
    quelqu'un verrait il une autre option ?
    Infographiste / Webdesigner / Intégrateur (un peu Développeur aussi si on peut dire ;p)
    On me trouve souvent dans la partie Hardware, Systèmes et Logiciels ou encore Webmasters - Développement Web et surtout dans le forum Wordpress.
    »» Mon Blog Musical (drumnbass)

  7. #7
    Inactif  
    Avatar de Kerod
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    11 672
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 11 672
    Points : 20 778
    Points
    20 778
    Par défaut
    Je te propose de partir sur ces infos : Comment vérifier que l'utilisateur a renseigné un champ d'un formulaire ? et même Comment vérifier que l'utilisateur a renseigné tous les champs texte d'un formulaire ?

    Je pense qu'avec avoir fait la même chose tout soucis se règlera

Discussions similaires

  1. [2.x] Formulaire : champ non obligatoire
    Par Manuk dans le forum Symfony
    Réponses: 2
    Dernier message: 19/05/2014, 12h41
  2. [1.x] Internationalisation fr obligatoire en non obligatoire
    Par amalec78 dans le forum Symfony
    Réponses: 2
    Dernier message: 24/01/2013, 13h33
  3. [Formulaire]Champ obligatoire si
    Par Tial dans le forum IHM
    Réponses: 2
    Dernier message: 26/03/2007, 14h37
  4. [Validator] champ date non obligatoire
    Par anjiniaina dans le forum Struts 1
    Réponses: 6
    Dernier message: 23/03/2007, 09h50
  5. Réponses: 2
    Dernier message: 07/11/2005, 18h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo