fonction qui regarde si les champs sont remplis
bonjour tous le monde
voila j'ai une fonction qui (normalement) regarde si mes champs sont remplis ou pas...
mais ca marche pô...
Code:
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
| <script language='javascript'>
valider_formulaire(thisForm)
{
if(thisForm.marque.value == '')
{
alert('Le champ marque doit être rempli');
thisForm.marque.focus();
return false;
}
if(thisForm.designation.value == '')
{
alert('Le champ designation doit être rempli');
thisForm.designation.focus();
return false;
}
if(thisForm.etat.value == '')
{
alert('Le champ etat doit être rempli');
thisForm.etat.focus();
return false;
}
if(thisForm.prix.value == '')
{
alert('Le champ prix doit être rempli');
thisForm.prix.focus();
return false;
}
return true;
}
</script>
<body>
<center><strong>creez un article</strong></center><br /><br />
<form name="form1" method="post"
action="creation_articles2.php" enctype="multipart/form-data"
onsubmit="valider_formulaire(this)">
marque : <br>
<input type="text" name="marque" ><br>
designation : <br>
<textarea name="designation" cols="55" rows="3"></textarea>
* attention a ne pas depasser 3 lignes<br>
etat : <br>
<input name="etat" type="text" id="specification"><br>
prix : <br>
<input name="prix" type="text" id="reference">
<br>
detail<br />
<textarea name="detail" cols="35" rows="7"></textarea>
<br />
detail anglais<br />
<textarea name="detail_anglais" cols="35" rows="7"></textarea>
<br />
image (.jpg)<br /><input type="file" name="avatar"><br />
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<div id="apDiv1">
<input type="checkbox" name="tourne" />tourner l'image</div>
<br /><input type="submit" name="envoyer" value="Envoyer ">
<div id="apDiv2">
<select name="choix">
<option value="appareil">appareil</option>
<option value="objectif">objectif</option>
<option value="accessoire">accessoire</option>
</select>
</div>
</form> |
pourquoi que quand j appuie sur le bouton, il envoie quand meme les POST?