473,414 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

problem function validate

I am not good in Javascript I begin I do not understand why my function does
not go I post my code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>contact.html</title>
<meta name="generator" content="Bluefish 1.0.7">
<meta name="author" content="swilting">
<meta name="date" content="2007-02-09T13:41:56+0100">
<meta name="copyright" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=UTF-8">
<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="expires" content="0">
<meta http-equiv="refresh" content="5; URL=http://">

</head>
<script type="application/x-javascript">
function validate()
{
if(document.info.nom.value=="")
{
alert("vous devez entrer votre nom.")
return false
}
if(document.info.prenom.value=="")
{
alert("vous devez entrer votre prenom.")
return false
}
if(document.info.mail.value=="")
{
alert("vous devez entrer votre mail.")
return false
}
if(document.info.body.value==")
{
alert("vous devez ecrire du texte dans le mail.")
return false
}
}

//-->
</script>
<body>

<table style="width: 100%;text-align: center;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><img
src="http://localhost/cgi-bin/random_image.cgi" align="middle"
border="0"><br>
</td>
</tr>
</tbody>
</table>
<br>
<hr style="width: 100%; height: 2px;"><br>
<table style="width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<form name="info" onsubmit="return validate()"
action="http://localhost/cgi-bin/mailperso.cgi" method="post"
enctype="multipart/form-data">
<br>
<hr style="width: 100%; height: 2px;"><br>
<p>vous pouvez m envoyer des e-mails personnalises pour que je travaille sur
vous idees</p>
<p>nom [obligatoire]</p>
<p></p>
<input type="text" name="nom" size="100" maxlength="100">
<p></p>
<p>prenom [obligatoite]</p>
<p></p>
<input type="text" name="prenom" size="100" maxlength="100">
<p></p>
<p>adresse mail [pas obligatoire]</p>
<input type="text" name="mail" size="100" maxlength="100">
<P>vous pouvez envoyer des images au format gif [pas obligatoire]</p>
<input type="file" name="attachement" size="50" maxlength="50">
<p>entrer le maximum d'information pour que l artiste travaille sur vos
idees</p>
<p>si vous n'avez pas remplie le champ mail indiquer votre numero de
telephone</p>
<textarea name="body" rows="5" cols="50"></textarea>
<p><input type="submit"></p>
</form><br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body>
</html>

Feb 9 '07 #1
1 1592
john.swilting wrote:
I am not good in Javascript I begin I do not understand why my function does
not go I post my code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>contact.html</title>
<meta name="generator" content="Bluefish 1.0.7">
<meta name="author" content="swilting">
<meta name="date" content="2007-02-09T13:41:56+0100">
<meta name="copyright" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=UTF-8">
<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="expires" content="0">
<meta http-equiv="refresh" content="5; URL=http://">

</head>
<script type="application/x-javascript">
function validate()
{
if(document.info.nom.value=="")
{
alert("vous devez entrer votre nom.")
return false
}
if(document.info.prenom.value=="")
{
alert("vous devez entrer votre prenom.")
return false
}
if(document.info.mail.value=="")
{
alert("vous devez entrer votre mail.")
return false
}
if(document.info.body.value==")
if(document.info.body.value=="")

Mick
{
alert("vous devez ecrire du texte dans le mail.")
return false
}
}

//-->
</script>
<body>

<table style="width: 100%;text-align: center;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><img
src="http://localhost/cgi-bin/random_image.cgi" align="middle"
border="0"><br>
</td>
</tr>
</tbody>
</table>
<br>
<hr style="width: 100%; height: 2px;"><br>
<table style="width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<form name="info" onsubmit="return validate()"
action="http://localhost/cgi-bin/mailperso.cgi" method="post"
enctype="multipart/form-data">
<br>
<hr style="width: 100%; height: 2px;"><br>
<p>vous pouvez m envoyer des e-mails personnalises pour que je travaille sur
vous idees</p>
<p>nom [obligatoire]</p>
<p></p>
<input type="text" name="nom" size="100" maxlength="100">
<p></p>
<p>prenom [obligatoite]</p>
<p></p>
<input type="text" name="prenom" size="100" maxlength="100">
<p></p>
<p>adresse mail [pas obligatoire]</p>
<input type="text" name="mail" size="100" maxlength="100">
<P>vous pouvez envoyer des images au format gif [pas obligatoire]</p>
<input type="file" name="attachement" size="50" maxlength="50">
<p>entrer le maximum d'information pour que l artiste travaille sur vos
idees</p>
<p>si vous n'avez pas remplie le champ mail indiquer votre numero de
telephone</p>
<textarea name="body" rows="5" cols="50"></textarea>
<p><input type="submit"></p>
</form><br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body>
</html>
Feb 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your...
4
by: bnp | last post by:
Hi All, I am quite new the JavaScript. Basically I am a C++ programmer, but now I am working on JavaScript since last 5 days. I have a problem regarding the form validation. I have created a...
3
by: z24 | last post by:
Hello I am having a bit of a problem with validating a form. All I want the form to do is if the user leaves a field empty for a notification to display. The latest thing I have tried is to use...
4
by: JJ_377 | last post by:
Why won't Netscape do the intended in the following? IE is able to render this page as intended. It is is a "self-posting" ASP form with a JavaScript validation function: if the form fails the...
8
by: Arthur Rusdell-Wilson | last post by:
I find that in a large form (especially if there is a table within the form?) that the form is submitted to my server-side script even when a JavaScript 'onsubmit' event handler returns 'false'. ...
1
by: z. f. | last post by:
in my custom validator ServerValidate function i set args.IsValid = False but the page execution continues like the page is valid and the validation summary doesn't show the error message . how...
1
by: ApexData | last post by:
Hello I have an UNBOUND textbox Text1 that I want to validate in code. I want to lock the user into the field until Valid Data is entered. I created the following Function: Private Function...
1
by: kusanagihk | last post by:
To all, I'm working on a javascript to dynamic build a common set of HTML controls. 01) I've used the DOM object to build a <div> tag; then build 1 <input type='button'/> and 1 <input...
1
by: Nacho | last post by:
Hello.. I have one problem with my reusable function to validate date.. I want to use this function to all my web project no validate date, but It's works fine if I have one textbox to...
1
by: John | last post by:
Hi I have two forms on my page. Both use javascript to validate input before submission. Problem is that first form does the validation fine but the second form gets submitted without any...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.