Voila j'ai un formulaire tout ce qu'il y a de plus classique, et mon <form> renvoie vers une fonction js qui est censée vérifier si mes champs ont été remplis mais lorsque je valide avec un champs vide rien ne se passe le javascript ne s'active pas.Mon code est pourtant bon ,je n'y comprend rien si qqun pourrait m'aider me mettre sur une piste ca serait cool
voici mon code:
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
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html dir="ltr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml" lang="fr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> <link rel="stylesheet" href="form.css" /> <title>C.A.B - Vue des details</title> <script type="text/javascript"> function verificationFormulaire (){ if(document.forms['form1'].getElementById['ref'].value == "" ){ alert("Merci de renseigner le champ : initiateur !" ); //document.form1.ini.focus(); return false; } //la fonction n'est pas complète evidemment, c'est un test sur un seul champ (initiateur) } </script> <style type="text/css"> h2{ margin-top:-10px; color:#0837B0; } table input[type="text"]{ width:95%; } .ombrage .colonne1{ background-color:#95C4D7; padding:2px 0; text-align:right; width:30%; } .ombrage .colonne2{ background-color:#95C4D7; padding:2px 0; padding-left:5px; text-align:left; width:25%; } .ombrage .colonne3{ background-color:#95C4D7; padding:2px 0; padding-left:5px; text-align:left; width:55%; } .ombrage .colonne4{ background-color:#95C4D7; padding:2px 0; padding-left:5px; text-align:left; width:25%; } .ombrage .colonne_colspan{ background-color:#95C4D7; padding:2px 0; padding-left:5px; text-align:left; width:70%; } table td.validation{ padding-top:8px; background-color:#95C4D7; } .ombrage{ border:2px solid white; } .ombrage .input_autre{ width:78%; } h4{ margin-top:0; margin-bottom:6px; } </style> <!--[if lte IE 8]> <style type="text/css"> .ombrage { filter:progid:DXImageTransform.Microsoft.Glow(color='#000000', Direction=45, Strength=0.5), progid:DXImageTransform.Microsoft.Shadow(color='#000000', Direction=135, Strength=3); zoom: 1; border:2px solid white; border-collapse:collapse; } .ombrage th,.ombrage td { border:0px solid white; } </style> <![endif]--> </head> <body > <center> <h2>detail du changement</h2> <form action="verif_modif.php" method="post" id="form1" name="form1" onsubmit="return verificationFormulaire()"> <table class="ombrage" border="0" cellspacing='0' cellpadding='0' width="90%;" style="box-shadow:2px 2px 4px black;" > <tr> <td class="colonne1" > <strong>ID : </strong> </td> <td class="colonne_colspan" colspan="2" > <input type="text" name="id" value=14 readonly > </td> </tr> <tr> <td class="colonne1" > <strong>Date de création : </strong> </td> <td class="colonne_colspan" colspan="2" > <input type="text" name="date-creation" value=2015-01-01 > </td> </tr> <tr> <td class="colonne1" > <strong>Référence : </strong> </td> <td class="colonne_colspan" colspan="2" > <input type="text" id="ref" name="ref" value=0 > </td> </tr> <tr> <td class="colonne1" > <strong>Initiateur : </strong> </td> <td class="colonne_colspan" colspan="2" > <textarea type="text" name="ini" rows="5" cols="50" value=test >test </textarea> </td> </tr> <tr> <td class="colonne1" > <strong>Changement : </strong> </td> <td class="colonne_colspan" colspan="2" > <textarea type="text" name="changement" rows="5" cols="50" >test ajout </textarea> </td> </tr> <tr> <td class="colonne1" > <strong>Porteur : </strong> </td> <td class="colonne_colspan" colspan="2" > <input type="text" name="porteur" value=test > </td> </tr> <tr> <td class="colonne1" > <strong>Acteurs CESTIF : </strong> </td> <td class="colonne_colspan" colspan="2" > <input type="text" name="acteur-cestif" value=test > </td> </tr> <tr> <td class="colonne1" > <strong>Description fonctionnelle : </strong> </td> <td class="colonne_colspan" colspan="2" > <textarea type="text" name="fonctionnelle" rows="5" cols="50" > test ajout </textarea> </td> </tr> <tr> <td class="colonne1" > <strong>Date de début: </strong> </td> <td class="colonne_colspan" colspan="2" > <input type="text" name="date-debut" value=0000-00-00> </td> </tr> <tr> <td class="colonne1" > <strong>Date de fin: </strong> </td> <td class="colonne_colspan" colspan="2" > <input type="text" name="date-cloture" value=0000-00-00> </td> </tr> <tr> <td class="colonne1" > <strong>Observations : </strong> </td> <td class="colonne_colspan" colspan="2" > <textarea type="text" name="obs" rows="5" cols="50">test ajout </textarea> </td> </tr> <tr> <td class="colonne1" > <strong>Impact CESTIF : </strong> </td> <td class="colonne_colspan" colspan="2" > <textarea type="text" name="impact-cestif" rows="5" cols="50">test ajout </textarea> </td> </tr> <tr> <td class="colonne1" > <strong>Impact utilisateurs: </strong> </td> <td class="colonne_colspan" colspan="2" > <textarea type="text" name="impact-user" rows="5" cols="50">test ajout </textarea> </td> </tr> <tr> <td class="colonne1"> <strong>Etat du changement :</strong> </td> <td class="colonne_colspan" colspan="2" > <select name="etat" id="Type_Travaux"> <option selected >A planifie</option> <option value="A planifier">A planifier</option> <option value="A démarrer">A démarrer</option> <option value="En cours">En cours</option> <option value="Terminé">Terminé</option> </select> </td> <tr> <!-- <tr> <td class="colonne1"> <strong>Type de travaux :</strong> </td> <td class="colonne_colspan" colspan="2" > <select name="Type_Travaux" id="Type_Travaux"> <option value=""></option> <option value="Climatisation">Climatisation</option> <option value="Electricité">Electricité</option> <option value="Sanitaire">Sanitaire</option> <option value="Autre">Autre</option> </select> </td> <tr> <td class="colonne1" > <strong>Description de la demande :</strong> </td> <td class="colonne_colspan" colspan="2"> <input type="text" name="description" > </td> </tr> <tr> <td class="colonne1"> <strong>Urgence :</strong> </td> <td class="colonne_colspan" colspan="2"> <select name="urgence" > <option value=""></option> <option value="Oui">Oui</option> <option value="Non">Non</option> </select> </td> </tr> --> <tr> <td style="padding-bottom:8px;" colspan="3" class="validation"> <center><INPUT border="0" src="images/bouton_validation.png" type="submit" value="submit" ></center> </td> </tr> </table> </form> <br/> <table> <caption><h4 style="color:#8C8E91">Menu</h4></caption> <tr align="center"> <td><a href="index.php"><br />Retour à l'accueil du<br />Suivi des CAB</a></td> </tr> </table> </center> </body> </html>
Partager