Jump to content

Help with Email Validation


This topic is 2925 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello

 

I have an email field in a Clients table that I would like to ensure has a valid email address to avoid any issues with typos and such

 

I'm not quite sure how I would go about doing this

 

Also, the field needs to be able to be empty as well

 

 

Link to comment
Share on other sites

I guess im just looking to make sure that it has an "@" and a period in it.

 

I found this through google, and it seems to work well:

Let ([ L = Length ( Self ) ;                                   // get length of eMail address
         At = Position ( Self ; "@" ; 1 ; 1 ) ;                // Find at least one @ signred
         Period = Position ( Self ;"." ;L ; -1 ) ] ;           // Find at least one period from a right to left search
         At > 1 and At < ( Period - 2 ) and Period < (L - 1)   // Return boolean T/F if @ and period were found in a normal email range
       )

But how do I allow the field to be empty as well?

Link to comment
Share on other sites

I guess im just looking to make sure that it has an "@" and a period in it.

 

That could be done very simply by =

 

PatternCount ( Self ; "@" ) and PatternCount ( Self ; "." ) or IsEmpty ( Self )

 

 

 

But how do I allow the field to be empty as well?

I didn't test your calculation, but I believe you could simply add:

...   or IsEmpty ( Self )

to the final line?

Link to comment
Share on other sites

What I posted above seems to work for my purposes.

 

I've put it in the Validate by Calculation section for the Email Field, but again, how do I allow the field to be empty and it not return an error?


 

I didn't test your calculation, but I believe you could simply add:

...   or IsEmpty ( Self )

to the final line?

 

hmmm...I thought I tried that earlier and it didn't work, but it works now.  I must have done something wrong the first time.

 

Thanks for your help

Link to comment
Share on other sites

This topic is 2925 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.