biiiink Posted December 4, 2014 Posted December 4, 2014 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
comment Posted December 4, 2014 Posted December 4, 2014 It depends on how you define "a valid email address". See: http://fmforums.com/forum/topic/36766-grab-the-email/?p=170870
biiiink Posted December 4, 2014 Author Posted December 4, 2014 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?
Lee Smith Posted December 4, 2014 Posted December 4, 2014 Biiiink, Have you done a search at http://www.briandunning.com for email? There are a ton of Custom Functions that deal with all aspects of parsing email addresses. HTH Lee
comment Posted December 4, 2014 Posted December 4, 2014 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?
biiiink Posted December 4, 2014 Author Posted December 4, 2014 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
Recommended Posts
This topic is 3699 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 accountSign in
Already have an account? Sign in here.
Sign In Now