email validation script recommendations

M

Morgan Packard

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
 
T

Thomas 'PointedEars' Lahn

Morgan said:
Is there a generally accepted technique for client-side email address
validation?

I suppose

<script type="text/javascript">
/**
* Determines whether <code>s</code> is 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</code> if <code>s</code> is syntactically valid,
* <code>false</code> otherwise.
* @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.
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
 
D

dhtml

Thomas said:
I suppose

<script type="text/javascript">
/**
* Determines whether <code>s</code> is 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</code> if <code>s</code> is syntactically valid,
* <code>false</code> otherwise.
* @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
 
T

Thomas 'PointedEars' Lahn

dhtml said:
Those look like JS Doc comments.

PointedEars' JSdoc[tm], to be precise.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top