For form validation on email characters "@, ." where do you place this script on the
template? Example form page would be great!
Thanks
KM
Seth Petry-Johnson wrote:
> >Im doing some server side validation and Im trying to make sure the '@' and
> the '.' is
> > in there. I have played with a variety of things and cant get it to work.
>
> I don't know about using a RegEX for this, but I've done it with normal
> string operations. The following script verifies that:
> 1) The email string is not empty
> 2) A "@" exists once and only once
> 3) At least one "." follows the "@", and the "." does not come at the very
> end of the string
>
> I wrote this a long time ago, so there may be a few holes in it.
>
> <!--- strEmail contains the entered email address --->
> <!--- booEmailValid is TRUE if it is a valid address --->
> <CFSET booEmailValid = "True">
>
> <!--- test the length --->
> <CFIF NOT Len(strEmail)>
> <CFSET booEmailValid = "False">
> <CFELSE>
> <!--- make sure only one '@' symbol exists, and that a "." follows
> it --->
> <CFSET intPosOfAt = Find("@", strEmail)>
> <CFSET intPosOfPer = Find(".", strEmail, intPosOfAt + 1)>
>
> <!--- make sure a "@" exists --->
> <CFIF intPosOfAt LTE 1>
> <CFSET booEmailValid = "False">
> <!--- make sure only 1 "@" exists --->
> <CFELSEIF Find("@", strEmail, intPosOfAt + 1)>
> <CFSET booEmailValid = "False">
> <CFELSEIF intPosOfAt EQ Len(strEmail)>
> <CFSET booEmailValid = "False">
> <CFELSEIF Find("@", strEmail, intPosOfAt + 1)>
> <!--- more than 1 '@', so this is invalid --->
> <CFSET booEmailValid = "False">
> <CFELSEIF (intPosOfPer EQ 0) OR (intPosOfPer EQ Len(strEmail)>
> <CFSET booEmailValid = "False">
> </CFIF>
> </CFIF>
>
> <CFIF booEmailValid>
> <!--- address is OK --->
> <CFELSE>
> <!--- address is not OK --->
> </CFIF>
>
> Hope this helps,
> Seth Petry-Johnson
> Argo Enterprise and Associates
>
> ------------------------------------------------------------------------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.