473,565 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Bluefi sh 1.0.7">
<meta name="author" content="swilti ng">
<meta name="date" content="2007-02-09T13:41:56+010 0">
<meta name="copyright " content="">
<meta name="keywords" content="">
<meta name="descripti on" content="">
<meta name="ROBOTS" content="NOINDE X, NOFOLLOW">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type"
content="applic ation/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="applicati on/x-javascript">
function validate()
{
if(document.inf o.nom.value=="" )
{
alert("vous devez entrer votre nom.")
return false
}
if(document.inf o.prenom.value= ="")
{
alert("vous devez entrer votre prenom.")
return false
}
if(document.inf o.mail.value==" ")
{
alert("vous devez entrer votre mail.")
return false
}
if(document.inf o.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.cg i" 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="retur n validate()"
action="http://localhost/cgi-bin/mailperso.cgi" method="post"
enctype="multip art/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="attacheme nt" 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 1617
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="Bluefi sh 1.0.7">
<meta name="author" content="swilti ng">
<meta name="date" content="2007-02-09T13:41:56+010 0">
<meta name="copyright " content="">
<meta name="keywords" content="">
<meta name="descripti on" content="">
<meta name="ROBOTS" content="NOINDE X, NOFOLLOW">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type"
content="applic ation/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="applicati on/x-javascript">
function validate()
{
if(document.inf o.nom.value=="" )
{
alert("vous devez entrer votre nom.")
return false
}
if(document.inf o.prenom.value= ="")
{
alert("vous devez entrer votre prenom.")
return false
}
if(document.inf o.mail.value==" ")
{
alert("vous devez entrer votre mail.")
return false
}
if(document.inf o.body.value==" )
if(document.inf o.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.cg i" 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="retur n validate()"
action="http://localhost/cgi-bin/mailperso.cgi" method="post"
enctype="multip art/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="attacheme nt" 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
6208
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 full name is required. Please enter your full name!'); validity = false; frmComments.name.focus();
4
2621
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 script that validates the form fields. the validation procedure is called ONCLICK event of the submit button. Follwowing is the structure of the...
3
353
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 onchange like this ONCHANGE=if(this.value.length < 1) alert('Please Enter your Name.') This problem with this method is that it does do the...
4
1683
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 JavaScript validation function, then the form should not post and an alert should be issued as indicated below. The *first* alert in the Validate...
8
1332
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'. does any one else have this problem, and is there a work-round? -- Arthur Rusdell-Wilson
1
2223
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 come? and how should it work, if the args parameter is passed byval? it won't go anywhere outside of the function scope isn't it? is this a bug...
1
2542
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 Validate(MyControl As Control) As Boolean If Len() < 6 Then MsgBox "Password too small" ' Etc..Etc.......
1
1533
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 type='text'> object 02) by using appendChild () method, I've successfully append the button and the textbox under the div tag (or container in this case)...
1
1758
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 validate in the same form, If I have two textbox the return doesn't works correctly.. how can I do this? if (document.Form1.TxtFechaIng.value!=''){
1
1466
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 validation taking place. Simplified form of code is given below. What am I doing wrong? Thanks
0
7584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.