• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to validate email domain

Explorer ,
Aug 11, 2006 Aug 11, 2006

Copy link to clipboard

Copied

looking for script that will do client side validation of email domain
TOPICS
Advanced techniques

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Aug 14, 2006 Aug 14, 2006
Sorry,
I didn't read your example address very well the first time.

^([_a-z0-9-]+(\.[_a-z0-9-]+)*@us\.mycompany\.com)?$

Votes

Translate

Translate
Explorer ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

Quickest way is to use cfform validation:
<cfform name="someForm" action="" format="html" preservedata="yes">
<cfinput type="text" validate="email" validateat="onsubmit,onserver" required="yes" message="Please Enter Valid Email">
</cfform>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

You'll need to use a REGEX (regular expression) script. Do a google search for 'coldfusion email regex'..finds plenty,

regards

Jon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

Finding a lot of regex that work great, problem is that I need to validate a specific domain (ex. us.mycompany.com).
I've tried manipulating this expression without luck:

Email: <CFINPUT TYPE="Text" NAME="email"
VALIDATE="regular_expression"
PATTERN=" ^([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.
(([a-z]{2,3})|(aero|coop|info|museum|name)))?$"
MESSAGE="Email is improperly formatted">

Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

^([_a-z0-9-]+(\.[_a-z0-9-]+)*@mydomain\.com)?$

If you have addresses like me.me@me.mydomain.com it may need to be modified.

Good Luck

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

Sorry,
I didn't read your example address very well the first time.

^([_a-z0-9-]+(\.[_a-z0-9-]+)*@us\.mycompany\.com)?$

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

LATEST
Thanks, that did the trick.
Much appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation