Click to See Complete Forum and Search --> : I must find a solution Who can help me?


diana
09-12-2003, 06:58 AM
HY

I have a form with 3 textboxes,then you push ENVOYER-bouton and you send a email....
I want to make the validation for the boxes...
I want ,when he don't write the name a message is comming
and the bouton ENVOYER don't work...
I hope you understand what I want!!!!

I want the people, must complete all the 3 boxes....

HOW CAN I DO iT?

<html>
<head>

<title>Alizé Centre de diffusion Artistique Formulaire </title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function submitForm(sub) {
document.forms[sub].submit();
}

function proceedSubmission() {
return confirm("Appuyez sur OK pour envoyer ces informations");
}


// -->
<!--
function formatMessage(){
var chaineMail="mailto:lupumihai@yahoo.fr";
chaineMail=chaineMail+"?subject="+formulaire.Nom.value;
chaineMail+="&body= Nom :"+formulaire.Nom.value + " " + " tel : " + formulaire.phone.value + " "+ " date :" +formulaire.data.value;
location.href=chaineMail;
}
// -->
</SCRIPT>
<script language="javascript">

function valider(){


// validation pour le nom
var nom1=formulaire.Nom.value;
if (nom1==0){
alert("Erreur!Vous devrez ecrire votre nom");
return;
}




}



</script>

<link href="../gogo.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#666699" text="#ffffff">
<div align="center"></div>

<form name="formulaire" onSubmit="formatMessage();"><br>
<center>
<h3> </h3>
<table width="390" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="320"><div align="center" class="soustitre"><font size="3"><strong>FORMULAIRE
POUR VOUS INSCRIRE</strong></font></div></td>
<td width="45"><img src="emailed.gif" width="45" height="52"></td>
</tr>
</table>
</center>

<table width="395" border="0" cellspacing="5" align="center" cellpadding="5">
<tr>
<td width="151" class="texteNorm"> <div align="center" class="unnamed1">Nom</div></td>
<td width="191"> <input type="text" name="Nom" size="30"> </td>
<td width="8"> </td>
</tr>
<tr>
<td width="151" > <div align="center" class="unnamed1">Téléphone</div></td>
<td width="191"> <input type="text" name="phone" size="30"> </td>
<tr>
<td width="151" valign="top" > <div align="center" class="unnamed1">Date
de l'événements</div></td>
<td width="191"> <input type="text" name="data" size="30"> </td>
<td width="8"> </td>
</tr>
</table>
<p> </p>
<p align="center">
<input type="submit" onClick="valider();" name="Submit" value=" Envoyer" >
<input type="reset" name="Submit2" value="Recommencer">
</p>
</form>

</table>


</body>
</html>




I write the function valider , but the email work!!!
I want ,that the email-bouton don't work,when the people
don't write in all the 3 boxes...

HOW CAN I DO IT?

THKS
DIANA


__________________

Fang
09-12-2003, 07:15 AM
Change function valider() to:
function valider(f){
// validation pour le nom
if (f.Nom.value==""){
alert("Erreur!Vous devrez ecrire votre nom");
f.Nom.focus();
return;
}
if (f.phone.value==""){
alert("Erreur!Vous devrez ecrire votre téléphone");
f.phone.focus();
return;
}
if (f.data.value==""){
alert("Erreur!Vous devrez ecrire votre date de l'événements");
f.data.focus();
return;
}
formatMessage();
}

Change these two lines:
<form action="mailto:lupumihai@yahoo.fr" name="formulaire" onSubmit="valider(this); return false;"><br>
and
<input type="submit" name="Submit" value=" Envoyer" >

pyro
09-12-2003, 07:17 AM
Take a look at http://www.infinitypages.com/research/formvalidation.htm

diana
09-12-2003, 07:58 AM
It's go very well!!!
Thanks very much!!!

But I have a little problem,too?
After I send the email I want to show a window.alert...
I put the window.alert in the function,where I have the email
and both appear in the same time...
I want the window appear after the email are sending...
Do you know how can I do?
THKS
DIANA