Skip to main content
Participant
September 19, 2007
Question

isValid() Email Validation

  • September 19, 2007
  • 1 reply
  • 336 views
I am somewhat new to CF and am trying to understand the logic behind the Email validation isValid(). From all of my searching I found there are 2 ways to do this. Listing the incorrect emails as arrays or just listing the string.

here is what I have:
<cfif isdefined("form.email")>
<cfif not isValid("regEx",Trim(form.email),"^[\w](([_\.\-]?[\w]+)*)@([\w]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,4}$)")>
Please provide your email address. <a href="javascript:history.back()">Back</a>
<cfabort>
</cfif></cfif>

What am I doing wrong and what is the best way to write the isValid() code?

Thank you
    This topic has been closed for replies.

    1 reply

    Inspiring
    September 19, 2007
    I don't know what all this array talk is about, but you can use the inbuilt email checking rather than regex:-

    isValid("email", orm.email)