Bonjour,
Je bloque sur un élément, et j'aurai besoin de votre aide s'il vous plaît :
en effet, j'essaye de vérifier que les selects qui ont le même name sont bien sélectionnés avec une option. Avec mon script, je réussis à vérifier le premier select, mais je bloque pour le deuxième select, mon script ne prends pas en compte celui-ci.
Voici mon code:
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 <table id="rma_create_form" method="post"> <tr class="detailsRma-1"> <td> <label for="reason" class="label required">Reason for return<em>*</em> :</label><br> <select class="validate-select" id="reason-1" name="reason"> <option value=""></option> <option value="1">No particular reason</option> <option value="2">delivery erro</option> <option value="3">bad size</option> <option value="4">defective</option> <option value="5">other reason</option> </select> </td> <td> <label for="exchange" class="label required">Do you want an exchange or a refund ?<em>*</em> :</label> <select class="validate-select" id="exchange-1" name="exchange"> <option value=""></option> <option value="1">refund on your method of payment</option> <option value="2">coupon on online customer accoun</option> <option value="3">purchase on invoice</option> </select> </td> </tr> <tr class="detailsRma-2"> <td> <label for="reason" class="label required">Reason for return<em>*</em> :</label><br> <select class="validate-select" id="reason-2" name="reason"> <option value=""></option> <option value="1">No particular reason</option> <option value="2">delivery erro</option> <option value="3">bad size</option> <option value="4">defective</option> <option value="5">other reason</option> </select> </td> <td> <label for="exchange" class="label required">Do you want an exchange or a refund ?<em>*</em> :</label> <select class="validate-select" id="exchange-2" name="exchange"> <option value=""></option> <option value="1">refund on your method of payment</option> <option value="2">coupon on online customer accoun</option> <option value="3">purchase on invoice</option> </select> </td> </tr> </table>
Merci d'avance pour votre aide !
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 jQuery(document).ready(function(){ jQuery.validator.setDefaults({ debug: true, success: "valid" }); jQuery("#rma_create_form").validate({ rules: { reason: "required", exchange: "required" }, messages: { reason: "Please select a reason for your resend", exchange: "Please enter the type of refund desired" }, }); });
Partager