December 4, 201411 yr 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
December 4, 201411 yr It depends on how you define "a valid email address". See: http://fmforums.com/forum/topic/36766-grab-the-email/?p=170870
December 4, 201411 yr Author 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?
December 4, 201411 yr 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
December 4, 201411 yr 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?
December 4, 201411 yr Author 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
Create an account or sign in to comment