Validat° formulaire malgre champs obligatoir

Résolu/Fermé
kahinazen Messages postés 8 Date d'inscription mardi 12 février 2008 Statut Membre Dernière intervention 2 juillet 2009 - 1 juil. 2009 à 23:24
kahinazen Messages postés 8 Date d'inscription mardi 12 février 2008 Statut Membre Dernière intervention 2 juillet 2009 - 2 juil. 2009 à 12:48
Bonjour,

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;" lang="fr-fr">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>mon site</title>
<meta content="N.F" name="author">
<meta content="Carterie d'Art pour la décoration de table"
name="description">
<link href="masterroot.css" type="text/css"
rel="stylesheet">
<link href="tables.css" type="text/css"
rel="stylesheet">
<link type="text/css" rel="stylesheet"
href="theme.css">
<style type="text/css"> </style>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8">
</head>
<body
style="color: rgb(61, 71, 112); background-color: rgb(219, 207, 230); background-image: url(http://ww12.photomaniak.com"
alink="#6c6b8e" link="#3d4770" vlink="#7f6793">
<bgsound src="000000000481.mid" autostart="true"
loop="1"></bgsound>
<div style="text-align: right;">
<script language="javascript" src="contact.js"
type="text/javascript"></script><a name="haut"></a></div>
<div
style="position: absolute; text-align: center; z-index: 3; left: 26px; width: 181px; top: 255px; height: 292px; font-family: Comic Sans MS;">
<dl>
<dt><big><a href="index.html">Accueil</a></big></dt>
<dt><big><a href="Mariage.html">Mariage</a>
</big> </dt>
<dt><big><a href="Generalites%20des%20collections.html">Généralités
des
Collections</a></big></dt>
<dt><big><a href="Nos%20collections.html">Nos
Collections</a></big></dt>
<dt><big><a href="Nos%20Evenementiels.html">Nos
Evènementiels</a></big></dt>
<dt><big><a href="demarches.html">Vos
Démarches</a></big></dt>
<dt><big><a href="contact.html">Contactez-Nous</a></big></dt>
<dt><big><a href="Partenaires.html">Partenaires</a></big></dt>
<dt><big><a href="Plansite.html">Plan
de Site</a></big></dt>
</dl>
</div>
<div style="text-align: center;">
<p><span style="font-family: Romantically Yours;"></span><img
style="width: 952px; height: 316px;"
alt="Au Royaume De Kate : Carterie d'Art pour la décoration de la table"
src="i718907_entetesite.jpg" align="top"></p>
<a href="index.html">
</a><img
style="position: absolute; left: -6px; width: 240px; height: 441px; top: 174px;"
alt="" src="i714222_parchemin.png">
<dl>
</dl>
<dl>
</dl>
<div style="margin-left: 240px;"><big><big><big><big><big><span
style="font-family: PlainBlack;">
 </span></big>
</big></big></big></big></div>
<big><big><big><big><big><span
style="font-family: PlainBlack;">
</span></big></big></big></big></big>
<div style="text-align: justify;">
<div style="text-align: center;"><big><big><big><big><big><span
style="font-family: PlainBlack;"></span></big></big></big></big></big></div>
<big><big><span style="font-family: PlainBlack;">
</span></big></big><big style="font-weight: bold;"><big><span
style="font-family: PlainBlack;"></span></big></big>
<div style="text-align: center; font-family: Comic Sans MS;"><big><big><big><big><br>
Contactez-nous<br>
</big></big></big></big></div>
<div style="text-align: center; font-family: Comic Sans MS;"><small><small>
</small></small></div>
<small><small>
</small></small>
<p style="font-family: Comic Sans MS;" class="paragraphe"
align="left"><big><big>Pour
plus d'informations prenez contact au :</big></big></p>
<p style="font-family: Comic Sans MS;" class="gras Style5"
align="left"><big><big>Téléphone
: mon numero de tel</big></big></p>
<p style="font-family: Comic Sans MS;" class="gras Style5"
align="left"><big><big>E-mail
: <a href="mailto:mon email"
target="_blank">mon email</a></big></big></p>
<big><big>Siret
: <small>mon n° siret</small></big></big><br>
<big><big><span style="font-family: PlainBlack;">
</span></big></big><!-- ici le début du formulaire avec la ligne qui envera le resultat à l'adresse e-mail correspondant à la page free l'hebergeant -->
<form name="contact" method="post"
action="mon hebergeur"> <big><big>
<select name="Civilité">
<option selected="selected">Mr</option>
<option>Mme</option>
<option>Mlle</option>
</select>
</big></big><big><big> Nom* :
    </big></big><big><big>
</big></big><big><big> 
 Prénom* : </big></big><big><big>   
        
Entreprise/Organisme
: <big><big><br>
</big></big> </big></big><input
name="nom" size="26"> <input name="prenom"
size="26"> <input size="34"
name="entreprise/organisme"> <br>
<big><big>Téléphone* : </big></big><big><big>     
     Fonction
: </big></big><big><big>   
          Ville*
:        
       
   Pays*
:</big></big><br>
<big><big> <input size="26" name="tel">
<input size="26" name="fonction"> <input
size="26" name="ville"> <input size="26"
name="pays"><br>
E-mail* :        
        Sujet* :<br>
<input size="26" name="email"> <input
size="80" name="Sujet"> </big></big><big><big>
</big></big><big><big> </big></big><big><big><br>
Message* :<br>
<textarea cols="115" rows="20" name="Message"></textarea></big></big><br>
<div style="text-align: right;"><big><big> </big></big>
</div>
<big><big> * <small>Champs obligatoires</small></big></big>
<br>
<input name="reset" value="Effacer" type="reset">
<input onclick="javascript: return verif();" name="Valider"
value="Valider" type="submit"></form>
<!-- ici la fin du formulaire -->
</div>
<br style="font-family: Comic Sans MS;">
<a style="font-family: Comic Sans MS;" href="#haut">Haut
de page</a><br style="font-family: Comic Sans MS;">
<br style="font-family: Comic Sans MS;">
<table style="text-align: left; width: 952px; height: 215px;"
border="1" cellpadding="2" cellspacing="2">
<script language="javascript" type="text/javascript">
<!-- Vérification des champs obligatoires du contact
function verif() { var nom = contact.nom.value;
if (contact.nom.value == "")
{
alert ('Veuillez entrer votre Nom');
contact.nom.value.focus();
return false;
}
if(contact.prenom.value == "")
{
alert ('Veuillez entrer votre Prénom');
contact.prenom.value.focus();
return false;
}
if(contact.tel.value == "")
{
alert ('Veuillez entrer votre numéro de téléphone');
contact.tel.value.focus();
return false;
}
if(contact.ville.value == "")
{
alert ('Veuillez entrer la ville');
contact.ville.value.focus();
return false;
}
if(contact.pays.value == "")
{
alert ('Veuillez entrer le pays');
contact.ville.value.focus();
return false;
}
if(contact.email.value == "")
{
alert ('Veuillez entrer votre email');
contact.email.value.focus();
return false;
}
if(contact.Sujet.value == "")
{
alert ('Veuillez entrer le sujet');
contact.Sujet.value.focus();
return false;
}
if(contact.Message.value == "")
{
alert ('Veuillez entrer le Message');
contact.Message.value.focus();
return false;
}
else {return true;}
}
//-->
</script>
<tbody>
<tr>
<td><span style="font-family: Comic Sans MS;"><span
style="text-decoration: underline;">le reste c'est du texte</span><span style="font-family: PlainBlack;"></span></div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

Alors mon souci c'est que malgre le champs obligatoire non rempli, et la fenetre m'indiquant le manque d'information, le formulaire se valide . Est ce que quelqu'un pourrait me dire ou j'ai buggé ? merci par avance

4 réponses

j'ai écris trop vite
Sur le bouton "valider", passe le type de "submit" à "button".
1
kahinazen Messages postés 8 Date d'inscription mardi 12 février 2008 Statut Membre Dernière intervention 2 juillet 2009
2 juil. 2009 à 12:48
merci ca marche nickel !!!!
bonne continuation
bye
0
Sur le bouton "valider", passe le type de "submit" à valider.
Puis dans le code de ta fonction verif() remplace "return true" par "contact.submit()".
0
kahinazen Messages postés 8 Date d'inscription mardi 12 février 2008 Statut Membre Dernière intervention 2 juillet 2009
2 juil. 2009 à 08:05
bonjour et merci gavalien,
je vais tester !!!
0
salut,
perso, l'appel à la fonction de vérification, je l'appellerai dans le <form>, où je mettrais : onsubmit=return verif()
0