473,396 Members | 2,129 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,396 software developers and data experts.

help required with validation

Hi everybody
I have the following form written in html which I need to validate.
Have tried a few things, but the validation bit written in javascript
does not seem to be getting accessed at all.
Can somebody please tell me what is wrong.
Thanks and regards,
hbm9966
<html>
<head>
<title>Contact us - Right Investments India</title>
<link rel="shortcut icon" href="favicon.ico">
<META Name="description" Content="Maximise your investment returns
while investing minimum time and effort">
<META Name="keywords" Content="equity, shares, stocks, pms, "portfolio
management", newsletters, trading, "technical analysis", investing">

<SCRIPT LANGUAGE="JavaScript">
function validate() {
alert("reached validation");
if (document.formail.Reply-to.value = "Enter your e-mail address
here"){
alert("Please enter your correct e-mail address");
return false;
}
if (document.formmail.subject.value.length < 3){
alert("Please enter a subject for your mail");
return false;
}
if (document.formmail.Text.value.length<3){
alert("Cannot send blank message");
return false;
}
return true;
}
</SCRIPT>
</head>

<body>
<blockquote>
<table rules=none border=0>
<td width = "30%">
<a href=index.html><img src = ".\images\logo3.gif" border=0
alt="Home"></a>
<td width = "70%" align = right>
<hr size=3 color=gold width=100% align=right>
<center><h3>Contact &nbsp Us</h3></center>
<hr size=3 color=gold width=100% align=right>
<td width = "0%">
</tr>
</table>

<form name="formmail" method="post" action="./formmail.php"
onSubmit="validate();">
<input type=hidden name="recipient" value="po********@rightinvest.com">
<b>From</b><br>
<input size=48 name="Reply-to" value="Enter your e-mail address here">
<br>
<input type=hidden name="email" value="co***********@rightinvest.com">
<b>Subject</b><br>
<input size=58 name="subject">
<br>
<b>Message</b><br>
<textarea cols=50 rows=6 name="Text"></textarea>
<input type="submit" value="Send">
<font
size=6>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nb sp&nbsp&nbsp&nbsp</font>
<font size=1>&nbsp&nbsp&nbsp&nbsp</font>
<a href="javascript:history.back()"><img src=".\images\backarrow.gif"
border=0></a>
<input type="hidden" name="redirect" value=".\thankspage.html">
</form>
</blockquote>
</body>
</html>

Nov 27 '05 #1
7 1271
hbm9966 wrote:
Hi everybody
I have the following form written in html which I need to validate.
Have tried a few things, but the validation bit written in javascript
does not seem to be getting accessed at all.
Can somebody please tell me what is wrong.
Thanks and regards,
hbm9966
<html>
<head>
<title>Contact us - Right Investments India</title>
<link rel="shortcut icon" href="favicon.ico">
<META Name="description" Content="Maximise your investment returns
while investing minimum time and effort">
<META Name="keywords" Content="equity, shares, stocks, pms, "portfolio
management", newsletters, trading, "technical analysis", investing">

<SCRIPT LANGUAGE="JavaScript">
function validate() {
alert("reached validation");
if (document.formail.Reply-to.value = "Enter your e-mail address
here"){
alert("Please enter your correct e-mail address");
return false;
}
if (document.formmail.subject.value.length < 3){
alert("Please enter a subject for your mail");
return false;
}
if (document.formmail.Text.value.length<3){
alert("Cannot send blank message");
return false;
}
return true;
}
</SCRIPT>
</head>

<body>


[snip]
You can't use minus signs in js identifiers, you can however work
around it:

if (document.forms['formail'].elements['Reply-to'].value =
"Enter your e-mail address here")

But this is a strange way to validate the text field.
Mick

Nov 27 '05 #2
Lee,
Thanks for your comprehensive reply.
Couldn't have asked for more.
regards,

Nov 28 '05 #3
Hi Mick,
that's true.
Actually I want to ensure that a valid e-mail address has been entered
in the text field.
Any suggestions will be appreciated.
thanks and regards,
hbm9966

Nov 28 '05 #4
JRS: In article <11**********************@g47g2000cwa.googlegroups .com>
, dated Sun, 27 Nov 2005 22:28:29, seen in news:comp.lang.javascript,
hbm9966 <ho*********@yahoo.com> posted :
Actually I want to ensure that a valid e-mail address has been entered
in the text field.
Any suggestions will be appreciated.


There can be no way of doing that.

See <URL:http://www.merlyn.demon.co.uk/js-valid.htm#VEmA>.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 29 '05 #5
Dr John Stockton wrote on 29 nov 2005 in comp.lang.javascript:
JRS: In article <11**********************@g47g2000cwa.googlegroups .com>
, dated Sun, 27 Nov 2005 22:28:29, seen in news:comp.lang.javascript,
hbm9966 <ho*********@yahoo.com> posted :
Actually I want to ensure that a valid e-mail address has been entered
in the text field.
Any suggestions will be appreciated.


There can be no way of doing that.


non-JS solution:

The OP could send an email to that address, and say "validated" if there is
no immediate error return mail.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 29 '05 #6
JRS: In article <Xn********************@194.109.133.242>, dated Tue, 29
Nov 2005 22:33:30 local, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :
Dr John Stockton wrote on 29 nov 2005 in comp.lang.javascript:
JRS: In article <11**********************@g47g2000cwa.googlegroups .com>
, dated Sun, 27 Nov 2005 22:28:29, seen in news:comp.lang.javascript,
hbm9966 <ho*********@yahoo.com> posted :
Actually I want to ensure that a valid e-mail address has been entered
in the text field.
Any suggestions will be appreciated.


There can be no way of doing that.


non-JS solution:

The OP could send an email to that address, and say "validated" if there is
no immediate error return mail.


No.

But it could say "invalidated" if there is an immediate error return
mail.

But even that is not altogether trustworthy, since E-mails can be
rejected, perhaps immediately, on grounds other than address. I auto-
reject any mail *from* merlyn, since I know none is sent and some is
forged.

I lease all of merlyn demon co uk and dial up occasionally.

Mail for *@merlyn.dcu will be held at Demon until I next connect; and
cannot be rejected until then. If I were to alter my settings to
collect only mail for legitimate names, mail to others would be returned
by Demon after 30 days.

If I were on broadband there would still be a small delay, a few
minutes, I think.

While not connected to the Internet, I can change the list of addresses
valid at merlyn; and no-one can detect that from outside this room,
until I next connect.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Nov 30 '05 #7
Dr John Stockton wrote on 30 nov 2005 in comp.lang.javascript:
While not connected to the Internet, I can change the list of addresses
valid at merlyn; and no-one can detect that from outside this room,
until I next connect.


I would not count that as an example of "valid", John.

Better perhaps,
is counting as INvalid,
all adresses that do not respond to a courteous request
to reply within 30 days?

This validation discussion is too dependent on definition,
as is found in many discussions.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 30 '05 #8

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

Similar topics

6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
2
by: qsweetbee | last post by:
I have a form(fAddUsers) in my database. It is continue form for data entry. Some fields are required fields. Some are optional fields. There is 1 particular filed(TokenExpirationDate)on the form...
5
by: Don Sealer | last post by:
I've got a validation rule that says something like =xx or xxx or zzzz. Though I may not have described it well it does work fine and that is really not my question. Here's what I'd like to do....
5
by: Mattyw | last post by:
Hi, I'm relatively new to Web Forms, I have been using Required Field Validators and Regular Expression Validators on a Web Form I am developing and everything works as expected using Visual...
36
by: aljamala | last post by:
Hi, I keep getting this warning on a page, but I do not know what the problem is...does anyone have an idea about what could be wrong? line 88 column 7 - Warning: missing </formbefore <td> it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
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.