[ic] Valid Email Checking

Mark Weaver mark at americanmicroinc.com
Thu Nov 18 12:58:16 EST 2004

Grant wrote:
>>Dear List,
>>IC 5.2.0
>>Is there a way to check a "value" for being a valid email address *without*
>>using a form profile?
>>Russell Mann
> Javascript will do that won't it?  I don't touch the stuff myself.  I
> would think you could get creative with an mv_click or mv_check too.

The following solution is untested, but should work. If you find that 
the "onBlur" event handler doesn't quite work out for you, try using an 
"onChange" event handler or another event handler that is more to your 
needs. The function is checking to see if the value in the email field 
contains the "@" symbol, and does not actually generate a message sent 
to the email address to test whether or not the address is functional. 
It merely checks to see if the address is formatted in a valid fashion.

Example: mickey2mouse at disney300world.com is in a valid email address 
format, but it likely would get bounced if one tried to send something 
to this address.

Also, you may find that you will have to adjust the regex in order for 
it to work correctly according to your needs.

<script language="javascript">
function check_email(fieldvalue)
     if ( fieldvalue !~ /[A-Z,a-z,0-9]\@[a-z,0-9]\.[a-z]/ )
	alert("This field must contain a valid email address.\nPlease
                check the value you entered and correct if necessary.");
     elsif ( fieldvalue == "" )
	alert("This field cannot be left blank.\nPlease enter a valid
	       email address.");

<input onBlur="check_email(this.value)" TYPE=text NAME=email VALUE="" 

Mark Weaver
American Micro Industries, Inc.
Webmaster/Database Systems Administrator
Remember: Amateurs built the Ark, Professionals built the Titanic

More information about the interchange-users mailing list