Titre: Champs Obligatoires Formmulaire
Posté par: Micho_Oko le le 10-11-2010 a 02:37:46
Bonjour,
Je cherche a rendre obligatoire certain champs dans un formulaire,
J'ai fait le code mais ça ne fonctionne pas (Texte en gras dans le quote) .
Pourriez vous m'aidez svp ? Merci beaucoup
=> Pour voir la forme : www.Fun-Tchat.fr
[html] <!-- START HTML --> <!-- Le corps du site --> <div id="corps">
<p> <h2>Connecter au Tchat de rencontre :</h2> <center><form action="/chat/index.php" method="post" class="Cadre" onSubmit="this.target = new Date().getMilliseconds(); w = window.open('', this.target, 'scrollbars=yes , menubar=no, toolbar=no, resizable=yes, screenX=50, screenY=50, width=2000, height=2000'); if (w != null && !w.closed) w.focus(); else this.target = '_top'; return(true);" onSubmit="return verif_champs()" name="connexion">
<h5><i>Veuillez remplir le formulaire ci-dessous.</i></h5> <table style="text-align: left; width: 100%;"> <tbody> <tr> <td> <table style="text-align: left; width: 100%; height: 100%;" id="log"> <tbody> <tr> <td style="border-right:1px solid #FFCCFF;"> <table style="text-align: left; width: 100%; height: 100%;"> <tbody> <tr> <td width="177"><font color="blue">Votre pseudo :</td><td width="261" colspan="1" style="width: 240px; font-weight: bold;"><input size="20" maxlength="32" id="pseudo" value="" name="pseudo"> </td> </tr> <tr> <td class="Style1">Mot de passe: </td> <td class="Style1"><input class="connexion0" type="password" name="passe" size="15" value="" /></td> </tr> </tbody> </table> </td> <td> <table id="info" width="100%" height="100%"> <tbody> <tr> <td><label></label> <select name="age" id="age" onchange="showItemAge(this.form.age);"><option value='24' >Age</option><option value='10' >10</option><option value='11' >11</option><option value='12' >12</option><option value='13' >13</option><option value='14' >14</option><option value='15' >15</option><option value='16' >16</option><option value='17' >17</option><option value='18' >18</option><option value='19' >19</option><option value='20' >20</option><option value='21' >21</option><option value='22' >22</option><option value='23' >23</option><option value='24' >24</option><option value='25' >25</option></select></td> <td><label></label> <select class="connexion3" name="sexe"> <option value=?>Sexe</option> <option value=M>Homme</option> <option value=F>Femme</option> </select> </td> </tr> <td ><label></label><br/> <select class="connexion4" name="ville"> <option value="Fun-Tchat">Region</option> <option>Somme</option> <option>Gironde</option> <option>Autre endroit</option> </select> </td> </tr> <tr> <td ><label>Couleur d'écriture:</label><br/> <select class="connexion5" name="couleur"> <option value="" >Default</option> <option value="2" style="background:#0000AA" >Bleu</option> <option value="3" style="background:#007F00" >Vert</option> </select></td> </tr> </tbody> </table> </td> </tr> </tbody> </table><div style="border-bottom:1px solid #255A7C;"></div> </td> </tr> <tr> <td> <table id="theme"> <tr> <tr><td width="650" align="left"><b><font <h2><center>Les salons du tchat</center></h2> <br><br/> <tr><td width="650" align="left"> <b><font color="red"><center>zone Principal :</center></font> <br><input type="checkbox" value="#accueil" name="salon" checked="checked" disabled>#Accueil <br><input type="checkbox" name="salon1" id="salon" value="#Le-Bar" />#Le-bar <br><input type="checkbox" value="#Rencontre" name="salon2">#Rencontre <tr><td width="650" align="left"> <b><font color="red"><center>zone pays :</center></font> <br><input type="checkbox" value="#Belgique" name="salon3">#belgique <br><input type="checkbox" value="#Algerie" name="salon4">#Algerie <br><input type="checkbox" value="#Tunisie" name="salon5">#Tunisie <br><input type="checkbox" value="#Quebec" name="salon6">#Quebec <tr><td width="650" align="left"> <b><font color="red"><center>zone thématique :</center></font> <br><input type="checkbox" value="#Gay" name="salon7">#Gay <br><input type="checkbox" value="#Lesbienne" name="salon8">#Lesbienne <br><input type="checkbox" value="#Adultes" name="salon9">#Adultes <br><input type="checkbox" value="#Ados" name="salon10">#Ados <br><input type="checkbox"value="#psychologie" name="salon16">#Psychologie <tr><td width="650" align="left"> <b><font color="red"><center>zone jeux :</center></font> <br><input type="checkbox" value="#Motus" name="salon11">#Motus <br><input type="checkbox" value="#Quizz" name="salon12">#Quizz <br><input type="checkbox" value="#Scrabble" name="salon13">#Scrabble <br><input type="checkbox" value="#Uno" name="salon15">#Uno <tr><td width="650" align="left"> <b><font color="red"><center>zone Technique :</center></font> <br><input type="checkbox" value="#Aide" name="salon2">#Aide <br><input type="checkbox" value="#Informatique" name="salon18">#Informatique </td></tr> </table> <br /> <br /> <td><br /><br /> </table> </td> </tr> </tbody> </table><br /><br /> <table width="100%"><tr align="center">
<script type="text/javascript"> function verif_champs() { if(document.connexion.pseudo.value == "") { alert("Veuillez entrer votre pseudo SVP"); document.connexion.pseudo.focus(); return false; } return true;} if(document.connexion.age.value == "Age") { alert("Veuillez entrer votre âge SVP"); document.connexion.age.focus(); return false; } return true;} if(document.connexion.ville.value == "Region") { alert("Veuillez entrer votre ville SVP"); document.connexion.ville.focus(); return false; } return true;} if(document.connexion.sexe.value == "Sexe") { alert("Veuillez entrer votre sexe SVP"); document.connexion.sexe.focus(); return false; } return true;] </script>
<INPUT NAME="Send" TYPE="image" VALUE="Send" SRC="/images/ok.png" ALT="connection..." onSubmit="return verif_champs()"></form> </tr> <tr align="center"> <td id="connect" > [/html]
|
|
|
Forum-webmaster | Actionné par YaBB SE
© 2001-2003, YaBB SE Dev Team. Tous droits réservés.
|