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 :

alerte formulaire au moment d'envoi


Sujet :

JavaScript

  1. #1
    Membre du Club
    Inscrit en
    Septembre 2005
    Messages
    169
    Détails du profil
    Informations forums :
    Inscription : Septembre 2005
    Messages : 169
    Points : 46
    Points
    46
    Par défaut alerte formulaire au moment d'envoi
    Bonjour,

    J'essaye de créer un petit jeu sur net!
    pour ce fait, j'ai créer ma formulaire, où j'ai mis des questions, condition d'acceptation au jeu et trois champs obligatoires (nom, prénom, age)!

    Mon soucie est comment faire des alertes pour:

    1/ si l'internaute oublie de remplir les 3 champs (non, prenom et age).
    2/ s'il oublie de répondre à une question ( les question sont des QCM (checkbox)).
    3/ s'il reponds mal au question y aura un petit message.
    4/ s'il reponds bien y aura un message de félicitation.
    5/ s'il oublie de cocher la case des conditions du jeu

    Voilà! voilà!
    Merci d'avance pour votre coup de pouce

  2. #2
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 666
    Points
    66 666
    Billets dans le blog
    1

  3. #3
    Membre du Club
    Inscrit en
    Septembre 2005
    Messages
    169
    Détails du profil
    Informations forums :
    Inscription : Septembre 2005
    Messages : 169
    Points : 46
    Points
    46
    Par défaut
    merci pour la reponse!!

    j'ai essayé de faire ca!
    Code : 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
    <HTML>
    <HEAD>
    <meta http-equiv=Content-Type content="text/html;  charset=ISO-8859-1">
     
     
    <TITLE></TITLE>
     
    <script language="JavaScript">
     
    function ErreurChampInfo(idChamp)
    	{
    		alert("Vous devez remplir les champs obligatoires");
    		idChamp.focus();
    	}
     
     
    function Verif()
    	{
    		if (document.form.nom.value == "")
    			{ErreurChampInfo(document.contact.nom);return false;}
    		if (document.form.prenom.value == "")
    			{ErreurChampInfo(document.contact.prenom);return false;}
    		if (document.form.age.value == "")
    			{ErreurChampInfo(document.contact.age);return false;}
     
     
     
     }	
    </script>
     
    </head>
    <body>
     
     
     
    <table border="0" width="100%">
    <form method="post" action="envoi_reponse.php" name="form"  >
            <tr>
              <td colspan="2" align="left" bgcolor="#FFFFFF" class="texte"><strong> Question 1 : </strong></td>
            </tr>
     
     
     
     <tr>
              <td width="8%" align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse a : </td>
        <td width="92%"><input type="checkbox" name="Q1a" value="ON"></td>
      </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse b : </td>
              <td><input type="checkbox" name="Q1b" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse c : </td>
              <td><input type="checkbox" name="Q1c" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
     
     
     
       <td colspan="2" align="left" bgcolor="#FFFFFF" class="texte"><strong>Question 2 : </strong></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse a :</td>
              <td><input type="checkbox" name="Q2a" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse b : </td>
              <td><input type="checkbox" name="Q2b" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse c :</td>
              <td><input type="checkbox" name="Q2c" value="ON"></td>
            </tr>
     
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
     
     
     
             <td colspan="2" align="left" bgcolor="#FFFFFF" class="texte"><strong>Question 3 : </strong></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse a : </td>
              <td><input type="checkbox" name="Q3a" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse b : </td>
              <td><input type="checkbox" name="Q3b" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse c : </td>
              <td><input type="checkbox" name="Q3c" value="ON"></td>
            </tr>
     
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
     
           <td colspan="2" align="left" bgcolor="#FFFFFF" class="texte"><strong>Question 4 : </strong></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse a : </td>
              <td><input type="checkbox" name="Q4a" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse b : </td>
              <td><input type="checkbox" name="Q4b" value="ON"></td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">R&eacute;ponse c : </td>
              <td><input type="checkbox" name="Q4c" value="ON"></td>
            </tr>
     
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td colspan="2" align="left" bgcolor="#FFFFFF" class="texte">
     
                <table width="428" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td width="23%" align="left" bgcolor="#FFFFFF" class="texte">Nom*</td>
                <td width="77%"> <input type="text" size="25" id ='nom' name="nom"> </td>
              </tr>
              <tr> 
                <td width="23%" align="left" bgcolor="#FFFFFF" class="texte">Pr&eacute;nom*</td>
                <td width="77%"> <input type="text" size="25" name="prenom"> </td>
              </tr>
              <tr> 
                <td width="23%" align="left" bgcolor="#FFFFFF" class="texte">age*</td>
                <td width="77%"> <input type="text" size="25" name="age"> </td>
              </tr></table>          </td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
    <td colspan="2" align="left" bgcolor="#FFFFFF" class="texte"><input type="checkbox" name="Accept" value="ON"> J'accepte les conditions g&eacute;n&eacute;rales du jeu</td>
            </tr>
            <tr>
              <td align="left" bgcolor="#FFFFFF" class="texte"><label>
                <input type="submit" name="button2"   id="button2" onClick="javascript:Verif();" value="Envoyer">
                </label>          </td>
              <td>&nbsp;</td>
            </tr>
     </form>     </table>
     
     
    </body>
    </html>
    mais il me manque la partie du checkbox!!
    comment je peux coder ca!!?

    merci d'avance

Discussions similaires

  1. [Joomla!] formulaire contact : pas d'envoi
    Par kamilane dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 2
    Dernier message: 10/12/2007, 16h52
  2. Formulaire Dreamweaver : Problème d'envoi de courriel
    Par CHRYSTAL STUDIO dans le forum Dreamweaver
    Réponses: 1
    Dernier message: 29/09/2007, 19h17
  3. [Configuration] Formulaire de contact et envoi d'e-mail
    Par platonus2002 dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 3
    Dernier message: 07/09/2007, 10h25
  4. Fenetre d'alerte formulaire
    Par Destiny dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 21/08/2007, 09h47
  5. [FORMULAIRE] question sur l'envoi
    Par xdoreau dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 25/06/2007, 17h51

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