Validating an email address
I need to validate an email address so that if the @ symbol is not entered or a full stop is not included an error message is produced.
Any ideas much appreciated.
You could use on onObjectSave trigger to run a script which checks
If [ PatternCount( Get(ActiveFieldContents) ; "@") and PatternCount (Get(ActiveFieldContents); ".") or IsEmpty(Get(ActiveFieldContents)) ]
Show Custom Dialog [...message...]
Exit Script [ Result : 0 ]
This way, the data would not save and the user would be forced to either enter an email with @ and . or clear the field.
You can do like SteveWright described or you can do a validation on the field:
-Validated by calculation
-Use this calculation: PatternCount ( EmailField ; "@" ) and PatternCount ( EmailField ; "." ) or IsEmpty ( EmailField )
You can always go a step further and test the mail using a free API.
The fantastic insert from URL has opened many such opportunities but I know some find it daunting.
I have therefore enclosed an example feel to get you going! !
Let ( [
ad = emailField
; at = Position ( ad ; "@" ; 1 ; 1 )
; dot = Position ( ad ; "." ; at ; 1 )
; end = Length ( ad )
at > 1 and dot > at + 1 and end > dot + 1
as usual, searching the forum can give valuable pointers, like this one:
Validating "@" Exists in an Email with Show Custom Dialog
Just going to point out that this thread was revived from 2010. It's highly likely that Brucey has already solved this one
Retrieving data ...