Connecting Tech Pros Worldwide Forums | Help | Site Map

email validation script recommendations

Morgan Packard
Guest
 
Posts: n/a
#1: Aug 21 '08
Hello,
Is there a generally accepted technique for client-side email address
validation? Can someone point me to a good, widely-used and tested
script?
thanks,
-morgan

Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#2: Aug 21 '08

re: email validation script recommendations


Morgan Packard wrote:
Quote:
Is there a generally accepted technique for client-side email address
validation?
I suppose

<script type="text/javascript">
/**
* Determines whether <code>s</codeis a syntactically
* valid e-mail address according to RFC2822, section 3.4.1.
*
* @param s : string
* Presumed e-mail address.
* @type boolean
* @return
* <code>true</codeif <code>s</codeis syntactically valid,
* <code>false</codeotherwise.
* @author TODO
*/
function isValidEmailAddr(s)
{
return ...
}

function isValidForm(f)
{
return isValidEmailAddr(f.elements['email'].value);
}
</script>

<form action="validate" onsubmit="return isValidForm(this)">
...
<input name="email" ...>
...
</form>

could qualify.
Quote:
Can someone point me to a good, widely-used and tested script?
That depends on what you expect "e-mail address validation" to be.
Generally, that is unlikely; search the archives.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Bart Van der Donck
Guest
 
Posts: n/a
#3: Aug 21 '08

re: email validation script recommendations


Morgan Packard wrote:
Quote:
Is there a generally accepted technique for client-side email address
validation? Can someone point me to a good, widely-used and tested
script?

http://www.merlyn.demon.co.uk/js-valid.htm#VEmA

Hope this helps,

--
Bart
MP
Guest
 
Posts: n/a
#4: Aug 21 '08

re: email validation script recommendations


Cool. Thanks.

-m-

On Aug 21, 11:34*am, Bart Van der Donck <b...@nijlen.comwrote:
Quote:
Morgan Packard wrote:
Quote:
Is there a generally accepted technique for client-side email address
validation? Can someone point me to a good, widely-used and tested
script?
>
*http://www.merlyn.demon.co.uk/js-valid.htm#VEmA
>
Hope this helps,
>
--
*Bart
dhtml
Guest
 
Posts: n/a
#5: Aug 21 '08

re: email validation script recommendations


Thomas 'PointedEars' Lahn wrote:
Quote:
Morgan Packard wrote:
Quote:
>Is there a generally accepted technique for client-side email address
>validation?
>
I suppose
>
<script type="text/javascript">
/**
* Determines whether <code>s</codeis a syntactically
* valid e-mail address according to RFC2822, section 3.4.1.
*
* @param s : string
* Presumed e-mail address.
* @type boolean
* @return
* <code>true</codeif <code>s</codeis syntactically valid,
* <code>false</codeotherwise.
* @author TODO
*/
function isValidEmailAddr(s)
Those look like JS Doc comments.

In JSDocToolkit, the return type can be specified in {}. For example:

/**
...
* @return {boolean} true, if the address is valid
* @param {string} s input string
* ...

The types can also be displayed as a link, for a user defined type,
annotated "@class". JSDocToolkit will create a link to that type.

* @return {MyType} object representing input data.
*/

Garrett
Quote:
>
PointedEars
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#6: Aug 21 '08

re: email validation script recommendations


dhtml wrote:
Quote:
Thomas 'PointedEars' Lahn wrote:
Quote:
>Morgan Packard wrote:
Quote:
>>Is there a generally accepted technique for client-side email address
>>validation?
>I suppose
>>
> <script type="text/javascript">
> /**
> * Determines whether <code>s</codeis a syntactically
> * valid e-mail address according to RFC2822, section 3.4.1.
> *
> * @param s : string
> * Presumed e-mail address.
> * @type boolean
> * @return
> * <code>true</codeif <code>s</codeis syntactically valid,
> * <code>false</codeotherwise.
> * @author TODO
> */
> function isValidEmailAddr(s)
>
Those look like JS Doc comments.
PointedEars' JSdoc[tm], to be precise.
Quote:
In JSDocToolkit, the return type can be specified in {}.
It would appear that this notation is not supported by the IDE that I am
using. Is there are purpose to your advertising JSDocToolkit here?


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Closed Thread