Bonjour
Je controle les champs obligatoires dans mon formulaire cependant cela ne marche pas.
Voici mon code javascript:
<script type="text/javascript">
function verifForm()
{
if (document.getElementById('collection').value == "" )
{
alert('La collection est non rempli !');
return false;
}
if (document.getElementById('nomBijoux').value == "" )
{
alert('Le nom du bijou est non rempli !');
return false;
}
if (document.getElementById('type').value == "" )
{
alert('Le type du bijou est non rempli !');
return false;
}
if (document.getElementById('libBijoux').value == "" )
{
alert('Le libelle du bijou est non rempli !');
return false;
}
if (document.getElementById('matiere').value == "" )
{
alert('La matiere du bijou est non rempli !');
return false;
}
if (document.getElementById('longueur').value == "" )
{
alert('La longueur du bijou est non rempli !');
return false;
}
if (document.getElementById('poids').value == "" )
{
alert('Le poids du bijou est non rempli !');
return false;
}
if (document.getElementById('saison').value == "" )
{
alert('La saison du bijou est non rempli !');
return false;
}
if (document.getElementById('annee1').value == "" )
{
alert('La première année du bijou est non rempli !');
return false;
}
if (document.getElementById('annee2').value == "" )
{
alert('La deuxième annee du bijou est non rempli !');
return false;
}
if (document.getElementById('photo1').value == "" )
{
alert('La première photo du bijou est non rempli !');
return false;
}
if (document.getElementById('photo2').value == "" )
{
alert('La deuxième photo du bijou est non rempli !');
return false;
}
if (document.getElementById('prixHT').value == "" )
{
alert('Le prix du bijou est non rempli !');
return false;
}
if (document.getElementById('enLigne').value == "" )
{
alert('L''état du bijou est non rempli !');
return false;
}
document.getElementById("fo" ).submit();
}
</script>
</head>
voici le code html:
<div id="pied_page">
<TABLE><!-- les boutons!-->
<p align="center"><input type="submit" value="ENREGISTRER" onClick="javascript:void(verifForm())"></font>
<p align="center"><input type="reset" value="EFFACER"></font>
<p align="center"><input type="button" id="valid" value="RETOUR" onclick="history.go(-1)"></p>
</TABLE>
Merci pour votre aide