cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate a email address using Validation Pattern?

Former Member
0 Kudos

Hi,

is there any document for Validation Pattern? i m looking for a way to validate email addresses in my form.

it's going to be something like * @ .

i have no idea of how to do this, or maybe validation pattern is no good? use java script instead?

any advice is appreciated!

thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello..

You can find "email address" object in the custom tab of the library. That will have all the validations by default.

Thanks

Gopal.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi erv2,

You just need to place this script in the "exit" event of the field that u r using for email address.


var r = new RegExp(); // Create a new Regular Expression Object.
    r.compile("^[a-z0-9_\\-\\.]+\\@[a-z0-9_\\-\\.]+\\.[a-z]{2,3}$","i");
if( this.rawValue == null || this.rawValue == "")
{
}
else
{									
var result = r.test(this.rawValue); 									
if (result == true) // If it fits the general form,
	true;			
else
{			
      xfa.host.messageBox("Please enter a valid email address ");
      this.rawValue = "";

      false;			// fail the validation.

}
}

Thanks

Amita

Edited by: amita arora on Jan 20, 2009 10:44 AM