> Hi everybody
> I have the following form written in html which I need to validate.
[quoted text clipped - 35 lines]
>
> <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
hbm9966 - 28 Nov 2005 06:28 GMT
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
Dr John Stockton - 29 Nov 2005 20:14 GMT
JRS: In article <1133159309.627350.303440@g47g2000cwa.googlegroups.com>
, dated Sun, 27 Nov 2005 22:28:29, seen in news:comp.lang.javascript,
hbm9966 <hormuzmaloo@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>.

Signature
© 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.
Evertjan. - 29 Nov 2005 22:33 GMT
Dr John Stockton wrote on 29 nov 2005 in comp.lang.javascript:
> JRS: In article <1133159309.627350.303440@g47g2000cwa.googlegroups.com>
> , dated Sun, 27 Nov 2005 22:28:29, seen in news:comp.lang.javascript,
[quoted text clipped - 4 lines]
>
> 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.

Signature
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
Dr John Stockton - 30 Nov 2005 15:57 GMT
JRS: In article <Xns971DEFA783DA1eejj99@194.109.133.242>, dated Tue, 29
Nov 2005 22:33:30 local, seen in news:comp.lang.javascript, Evertjan.
<exjxw.hannivoort@interxnl.net> posted :
>Dr John Stockton wrote on 29 nov 2005 in comp.lang.javascript:
>
[quoted text clipped - 11 lines]
>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.

Signature
© 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.
Evertjan. - 30 Nov 2005 18:40 GMT
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.

Signature
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
hbm9966 said:
>Hi everybody
>I have the following form written in html which I need to validate.
I see three problems:
><SCRIPT LANGUAGE="JavaScript">
1. This is not causing your problem, but should be fixed.
The "language" attribute is out-dated. Use:
<script type="text/javascript">
>function validate() {
> alert("reached validation");
> if (document.formail.Reply-to.value = "Enter your e-mail address
>here"){
2. Two serious problems in the line above:
a) The equality comparison operator is "==", not "=".
As written, that is an assignment operation.
b) The left-hand side of that line contains an unintended
subtraction operation:
document.formail.Reply minus to.value
In the current form, as an assignment operation, the browser
is rejecting your entire function because you may not assign
a value to the result of a subtraction operation.
When you correct the operator, the function will be allowed,
so you will see the "alert()", but it will still cause an error
because it can't find the two operands for the subtraction.
You need to either change the name of the "Reply-to" field to
something that doesn't contain a minus sign, or use square-
bracket notation to refer to it:
document.formail.elements["Reply-to"].value
This is not the last problem, read on.
><form name="formmail" method="post" action="./formmail.php"
>onSubmit="validate();">
3. In order for the onsubmit handler to prevent the form from
being submitted, it must return false. Your onsubmit handler
does not return any value.
Your "validate()" function returns a value, but it is not
really your onsubmit handler. It's just a function that is
called by your onsubmit handler.
The onsubmit handler is generated for you, using as the body
of the function the text of the "onsubmit" attribute of the
form tag. You want the body of that function to return the
value returned by your validate() function:
onsubmit="return validate()"
hbm9966 - 28 Nov 2005 06:26 GMT
Lee,
Thanks for your comprehensive reply.
Couldn't have asked for more.
regards,