Bonjour,

Je n'arrives pas à mettre en place la vérification des champs de mon formulaire. (Malgré la suivie de plusieurs tutoriaux)
Voici mon code de formulaire :
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
 
 
<script src="JS_Functions/FunctionJSInscription_testcontenu.js" type="text/javascript"></script>
<form name="f" method=post enctype="multipart/form-data" onsubmit="return verification()" action="InsertData.php" >
	<table border=0 width="800 px">
		<tr><td colspan="5">&nbsp;</td></tr>
		<tr>
			<td class='inscription-etatcivil'>Nom</td>
			<td><INPUT type=text name="nom"></td>
			<td>&nbsp;</td>
			<td class='inscription-etatcivil'>Pr&eacute;nom</td>
			<td><INPUT type=text name="prenom"></td>
		</tr>
		<tr>
	<?php
		presentationvilles();
	?>
			<td>&nbsp;</td>
			<td class='inscription-etatcivil'>Mail</td>
			<td><INPUT type=text name="mail"></td>
		</tr>
		<tr>
			<td class='inscription-etatcivil'>T&eacute;l&eacute;phone</td>
			<td><INPUT type=text name="tel"></td>
			<td>&nbsp;</td>
			<td class='inscription-etatcivil'>Mobile*</td>
			<td><INPUT type=text name="mob"></td>
		</tr>
		<tr>
			<td class='inscription-etatcivil'>Photo*</td>
			<td colspan='2'><INPUT type="file" name="photo"></td>
			<td class='inscription-etatcivil'>Soci&eacute;t&eacute;</td>
			<td><INPUT type=text name="societe"></td>
		</tr>
		<tr><td colspan="5"><input type="submit" value="Envoyer"></td></tr>
	</table></form>

Voici ma fonction javascript :
Code javascript : 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
 
 
function verification()
{
prenom=document.getElementById('prenom').value;
nom=document.getElementById('nom').value;
societe=document.getElementById('societe').value;
telephone=document.getElementById('tel').value;
email=document.getElementById('mail').value;
 
   if (prenom=="" || nom=="" ||  societe=="" || telephone=="" || email=="")
  {
			alert ("Vous devez remplir tous les champs qui ne sont pas facultatifs!");
			return false;
  }
  else
  {
	document.form.submit.type="submit";
  } 
 
return true;
}

Donc il y a bien un appel à la fonction mais pas plus. Si 1 ou tous les champs sont vides on est quand même dirigé vers la page d'insertion des compétences sans qu'aucune alerte n'apparaisse...

Si vous savez pourquoi, merci de m'expliquer .