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

Conception Web Discussion :

Rendre tous les questions obligatoires dans un FORM


Sujet :

Conception Web

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juin 2022
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2022
    Messages : 14
    Points : 6
    Points
    6
    Par défaut Rendre tous les questions obligatoires dans un FORM
    Bonjour,

    je viens solliciter votre aides je souhaite que ce formulaire toutes les questions doivent être obligatoire sauf : Moyen de locomotion, Profession, Disponibilité motage démontage

    Merci énormément


    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
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    <label>Votre Nom :<br>
        <input type="text" name="your-name" autocomplete="name" required>
      </label><br><br>
     
      <label>Votre Prénom :<br>
        <input type="text" name="text-163" placeholder="Prénom">
      </label><br><br>
     
      <fieldset>
        <legend>Sexe</legend>
        <label>
          <input type="radio" name="sexe" value="Femme">
          F
        </label>
        <label>
          <input type="radio" name="sexe" value="Homme">
          H
        </label>
      </fieldset><br>
     
      <label>Date de naissance :<br>
        <input type="date" name="date-of-birth" required>
      </label><br><br>
     
      <label>Votre numéro de téléphone :<br>
        <input type="tel" name="your-phone" required>
      </label><br><br>
     
      <label>Votre adresse email :<br>
        <input type="email" name="email-590" placeholder="Votre adresse email" required>
      </label><br><br>
     
      <label>Taille de tenues* :<br>
        <input type="radio" name="taille" value="S" id="taille-s" required>
        <label for="taille-s">S</label>
        <input type="radio" name="taille" value="M" id="taille-m">
        <label for="taille-m">M</label>
        <input type="radio" name="taille" value="L" id="taille-l">
        <label for="taille-l">L</label>
        <input type="radio" name="taille" value="XL" id="taille-xl">
        <label for="taille-xl">XL</label>
        <input type="radio" name="taille" value="XXL" id="taille-xxl">
        <label for="taille-xxl">XXL</label>
        <input type="radio" name="taille" value="Autre" id="taille-autre">
        <label for="taille-autre">Autre</label>
        <br><br>
     
        <span id="taille-autre-wrap" style="display:none;">
          <label>Autre :<br>
            <input type="text" name="taille-autre">
          </label>
        </span>
      </label><br><br>
     
    <label>Langues* :</label>
     
    <div class="wpcf7-form-control-wrap langues">
        <span class="wpcf7-form-control wpcf7-checkbox">
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="langues[]" value="Français" />
                    <span class="wpcf7-list-item-label">Français</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="langues[]" value="Anglais" />
                    <span class="wpcf7-list-item-label">Anglais</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="langues[]" value="Allemand" />
                    <span class="wpcf7-list-item-label">Allemand</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="langues[]" value="Espagnol" />
                    <span class="wpcf7-list-item-label">Espagnol</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="langues[]" value="Italien" />
                    <span class="wpcf7-list-item-label">Italien</span>
                </label>
            </span>
            <span class="wpcf7-list-item last">
                <label>
                    <input type="checkbox" name="langues[]" value="Autre" onclick="document.getElementById('autreLangue').style.display = this.checked ? 'block' : 'none';" />
                    <span class="wpcf7-list-item-label">Autre :</span>
                </label>
            </span>
        </span>
    </div>
    <div id="autreLangue" style="display:none;">
        <label>Précisez :</label>
        <input type="text" name="autreLangue" size="40" />
    </div>
     
    <label>Comment avez-vous entendu parler du Tournoi ?</label>
    <span class="wpcf7-form-control-wrap choices">
        <span class="wpcf7-form-control wpcf7-checkbox">
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="choices[]" value="Bouche à oreille" />
                    <span class="wpcf7-list-item-label">Bouche à oreille</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="choices[]" value="Site Web du tournoi" />
                    <span class="wpcf7-list-item-label">Site Web du tournoi</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="choices[]" value="Campagne de communication" />
                    <span class="wpcf7-list-item-label">Campagne de communication</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="choices[]" value="Réseaux sociaux" />
                    <span class="wpcf7-list-item-label">Réseaux sociaux</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="choices[]" value="Presse" />
                    <span class="wpcf7-list-item-label">Presse</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="choices[]" value="Déjà participé" />
                    <span class="wpcf7-list-item-label">Déjà participé</span>
                </label>
            </span>
            <span class="wpcf7-list-item other">
                <label>
                    <input type="checkbox" name="choices[]" value="Autre" onclick="if(this.checked){document.getElementById('other_choice').style.display='block';}else{document.getElementById('other_choice').style.display='none';}" />
                    <span class="wpcf7-list-item-label">Autre :</span>
                </label>
            </span>
            <span class="wpcf7-form-control-wrap other-choice" style="display:none;" id="other_choice">
                <label>
                    <span class="wpcf7-list-item-label">Saisissez votre choix :</span>
                    <input type="text" name="other_choice" />
                </label>
            </span>
        </span>
    </span>
     
    <label> Moyen de Locomotion :
    [text text-171 "Moyen de Locomotion"] </label>
     
    <label> Profession :
    [text text-192 "Profession"] </label>
     
     
    <label for="photo_identite">Importer votre photo d'identité :</label>
    <input type="file" id="photo_identite" name="photo_identite" accept="image/*" required>
     
     
    <label>Sélectionnez vos Périodes (6 minimum) *</label>
    <table>
        <thead>
            <tr>
                <th></th>
                <th>P1</th>
                <th>P2</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Samedi 20 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Samedi 20 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Samedi 20 Mai P2"></td>
            </tr>
            <tr>
                <td>Dimanche 21 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Dimanche 21 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Dimanche 21 Mai P2"></td>
            </tr>
            <tr>
                <td>Lundi 22 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Lundi 22 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Lundi 22 Mai P2"></td>
            </tr>
            <tr>
                <td>Mardi 23 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Mardi 23 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Mardi 23 Mai P2"></td>
            </tr>
            <tr>
                <td>Mercredi 24 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Mercredi 24 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Mercredi 24 Mai P2"></td>
            </tr>
            <tr>
                <td>Jeudi 25 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Jeudi 25 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Jeudi 25 Mai P2"></td>
            </tr>
            <tr>
                <td>Vendredi 26 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Vendredi 26 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Vendredi 26 Mai P2"></td>
            </tr>
            <tr>
                <td>Samedi 27 Mai</td>
                <td><input type="checkbox" name="periodes[]" value="Samedi 27 Mai P1"></td>
                <td><input type="checkbox" name="periodes[]" value="Samedi 27 Mai P2"></td>
            </tr>
        </tbody>
    </table>
    <button type="button" onclick="checkDisponibilite()">Vérifier Disponibilité</button>
     
    <script>
    function checkDisponibilite() {
        const checkboxes = document.querySelectorAll('input[name="periodes[]"]:checked');
        if (checkboxes.length < 6) {
            alert("Veuillez sélectionner au moins 6 périodes.");
        }
    }
    </script>
    <script>
    function validateCheckboxes() {
        const checkboxes = document.querySelectorAll('input[name="periodes[]"]:checked');
        if (checkboxes.length < 6) {
            alert("Veuillez sélectionner au moins 6 périodes.");
    }
    }
    </script>
     
     
    <label for="disponibilites-montage-demontage">Disponibilités Montage/Démontage :</label><br />
     
    <span class="wpcf7-form-control-wrap disponibilites-montage-demontage">
        <span class="wpcf7-form-control wpcf7-checkbox">
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Lundi 15 mai" />
                    <span class="wpcf7-list-item-label">Lundi 15 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Mardi 16 mai" />
                    <span class="wpcf7-list-item-label">Mardi 16 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Mercredi 17 mai" />
                    <span class="wpcf7-list-item-label">Mercredi 17 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Jeudi 18 mai" />
                    <span class="wpcf7-list-item-label">Jeudi 18 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Vendredi 19 mai" />
                    <span class="wpcf7-list-item-label">Vendredi 19 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Lundi 29 mai" />
                    <span class="wpcf7-list-item-label">Lundi 29 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Mardi 30 mai" />
                    <span class="wpcf7-list-item-label">Mardi 30 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Mercredi 31 mai" />
                    <span class="wpcf7-list-item-label">Mercredi 31 mai</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="checkbox" name="disponibilites-montage-demontage[]" value="Jeudi 01 juin" />
                    <span class="wpcf7-list-item-label">Jeudi 01 juin</span>
                </label>
            </span>
        </span>
    </span>
     
     
     
    <label>Avez vous besoin d'une attestation?  
    </label><br>
     
    <div class="wpcf7-form-control-wrap participation">
        <span class="wpcf7-form-control wpcf7-radio">
            <span class="wpcf7-list-item">
                <label>
                    <input type="radio" name="participation" value="oui">
                    <span class="wpcf7-list-item-label">Oui</span>
                </label>
            </span>
            <span class="wpcf7-list-item">
                <label>
                    <input type="radio" name="participation" value="non">
                    <span class="wpcf7-list-item-label">Non</span>
                </label>
            </span>
        </span>
    </div>
     
    <label for="checkbox-cg">
        <input type="checkbox" name="checkbox-cg" id="checkbox-cg" required>
        J'ai lu et j'accepte les <a href="conditions-generales" target="_blank">conditions générales</a>
    </label> 
     
    [submit "Envoyer mon formulaire"]

  2. #2
    Membre expert
    Avatar de ThomasR
    Homme Profil pro
    Directeur technique
    Inscrit en
    Décembre 2007
    Messages
    2 230
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2007
    Messages : 2 230
    Points : 3 972
    Points
    3 972
    Par défaut
    Hello,

    Tu peux ajouter un attribut "required" sur les champs de ton formulaire.

    https://developer.mozilla.org/fr/doc...butes/required

    Cela va faire en sorte que, côté navigateur, la soumission du formulaire ne sera possible que si ces champs sont complétés.
    Il faudra également, par sécurité, vérifier ces saisies côté serveur.

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juin 2022
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2022
    Messages : 14
    Points : 6
    Points
    6
    Par défaut
    Bonjour,

    Même en utilisant required ça ne marche toujours pas

    Les utilisateurs peuvent quand même envoyer leur formulaire sans remplir la moitié des champs demander

Discussions similaires

  1. Réponses: 4
    Dernier message: 22/12/2012, 00h01
  2. Réponses: 4
    Dernier message: 17/09/2008, 14h12
  3. [Forms 6i] Trouver tous les form ouverts
    Par reppier dans le forum Forms
    Réponses: 2
    Dernier message: 12/10/2007, 19h19
  4. [VB.net 2005] Rendre tous les formulaires invisibles
    Par PoZZyX dans le forum Windows Forms
    Réponses: 1
    Dernier message: 29/05/2006, 14h23
  5. Réponses: 4
    Dernier message: 15/05/2006, 00h03

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