J'ai un formualire avec le premier champs obligatoire de type texte et qui ne doit pas etre nul.
Actuellement je vérifie juste s'il n'est pas nul.
Et lorsque je clic sur submit il me fait bien l'alert mais m'envoie qd meme mon formulaire.
Voici le code :
<html>
<head>
<link rel="stylesheet" href="/LGAppli/css/default.css" type="text/css">
<title>CREATION D'UNE APPLICATION</title>
<script LANGUAGE="JavaScript">
function verif() {
nom=document.forms[0].elements[0].value;
if(nom == "") {
alert("Indiquez le nom de l'application, SVP.");
}
return(false);
}
</script>
</head>
<body>
<table width="670" border="0" align="center" cellspacing="0">
<tr>
<td height="800"><table width="670" border="1" cellspacing="0">
<tr>
<td bgcolor="#666666"><div align="center"><b>Ajout Application</b></div></td>
</tr>
</table>
<table width="670" height="692" border="1" align="center" cellspacing="0">
<!-- <tr>
<td bgcolor="#99CCFF"><h3 align="center">$!vm_resultat</div></h3>
</td>
</tr> -->
<tr>
<td height="639" bgcolor="#99CCFF"> <form name="form1" method="GET" OnSubmit="javascript:verif()" action="/LGAppli/servlet/LGAppli_application_insertion2">
<table width="640" border="1" align="center" cellspacing="0">
<tr>
<td colspan="2" bgcolor="#999999"><b><img src="../../images/spacer.gif" width="8" height="8">Nom
</b></td>
<td width="55%" bgcolor="#CCCCCC"><b><img src="../../images/spacer.gif" width="8" height="8"></b>
<input type="text" name="appli_nom"></td>
</tr>
<tr>
<td colspan="2" bgcolor="#999999"><b><img src="../../images/spacer.gif" width="8" height="8">Version
</b></td>
<td bgcolor="#CCCCCC"><b><img src="../../images/spacer.gif" width="8" height="8"></b>
<input type="text" name="appli_version" ></td>
</tr>
<tr>
<td colspan="2" bgcolor="#999999"><b><img src="../../images/spacer.gif" width="8" height="8">Description
</b></td>
<td bgcolor="#CCCCCC"><b><img src="../../images/spacer.gif" width="8" height="8"></b>
<textarea name="appli_description" cols=30 rows=3></textarea></td>
</tr>
(...)
<tr>
<td width="15%" height="26"></td>
<td width="10%" bgcolor="#999999"><b><img src="../../images/spacer.gif" width="8" height="8">Fax
</b></td>
<td bgcolor="#CCCCCC"><b><img src="../../images/spacer.gif" width="8" height="8"></b>
<input type="text" name="appli_fax_interloc"></td>
</tr>
</table><br>
<table width="202" border="0" align="center" cellspacing="0">
<tr>
<td width="339" bgcolor="#99CCFF"><div align="center">
<input type="submit" name="bouton_creer" value="Creer">
<!-- <input type="hidden" name="nom_appli" value="$!vm_appli"> -->
</div></td>
</tr>
</table><br>
</form>
</td>
</tr>
<tr>
<td height="25" bgcolor="#CCCCCC"><table width="640" border="0" align="center" cellspacing="0">
<tr>
<td width="50%"><div align="center"><a href="/LGAppli/jsp/application.jsp">Précèdent</a></div></td>
<td width="52%"><div align="center"><a href="/LGAppli/index.jsp">Menu</a></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
S ke qq'1 peut me dire pourquoi il passe a la page suivante donc fait l'action du form alors que je lui ai mis un return false
Merci
et aussi comment vérifier qu'il s'agit bien d'un tuype texte sans caracteres speciaux ni espace.
Mars'L