Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Forms wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category All IBM Forms 4.0 documentation IBM Forms Server 4.0 API documentation Custom Search Scope...
Search
Community Articles > Best Practices for Form Design > Field Formatting Best Practices > Formatting email addresses
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Deanna Drschiwiski
Contribution Summary:
  • Articles authored: 102
  • Articles edited: 225
  • Comments Posted: 5

Recent articles by this author

IBM Product Documentation - English (American)

The following documents are available in English (American):

IBM Translated Product Documentation - Turkish (Türk)

Provides accessible documentation in Turkish (Türk)

IBM Translated Product Documentation - Spanish (Español)

Provides accessible documentation in Spanish (Español)

IBM Translated Product Documentation - Slovenian (Slovenski)

Provides accessible documentation in Slovenian (Slovenski)

IBM Translated Product Documentation - Slovak (Slovenských)

Provides accessible documentation in Slovak (Slovenských)

Community articleFormatting email addresses

Added by Deanna Drschiwiski | Edited by IBM contributor Ryan Nordman on September 29, 2011 | Version 10
  • Edit
  • More Actions Show Menu▼
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars
expanded Abstract
collapsed Abstract
You can format an email address field so it only accepts a valid email address format or an email address from a specific domain.
Tags: email address, field, format
ShowTable of Contents
HideTable of Contents
    • 0.1 Accepting any email address
    • 0.2 Accepting only email addresses from a specific domain
    • 0.3 Examples
    • 0.4 Exceptions to this practice

Image:Using the correct font for your locale Image:Using the correct font for your locale
You can format an email address field so it only accepts a valid email address format or an email address from a specific domain.

Email addresses only come in one format: a string of alphanumeric characters (which may include punctuation symbols), followed by the @ sign, and concluded with a domain name. There are two primary ways to format email address fields:
  • To accept any email address
  • To accept only email addresses from a particular domain

Accepting any email address



To format a field to accept any email address (and reject any data that is not an email address), you must create an input constraint pattern. You must use a Unix-style regular expression to specify this pattern. For example, the following regular expression configures a field to accept any email address, but rejects any that do not contain an @ symbol or domain name:

([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)

Accepting only email addresses from a specific domain



To format a field to only accept email addresses from a particular domain, you must create an input constraint pattern that specifies the required domain name. You must use a Unix-style regular expression to specify this pattern. For example, the following regular expression configures a field to accept only email addresses with an IBM® domain:

([a-zA-Z0-9_\-\.]+)@ibm\.com

Examples



The following code sample shows how to create a field that accepts any email address:
<field sid="FIELD24">
    <label>E-Mail Address</label>
    <format>
        <datatype>string</datatype>
        <constraints>
            <patterns>
              <pattern>([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)</pattern>
            </patterns>
       </constraints>
    </format>
    <value></value>
</field> 


The following code sample shows how to create a field that accepts only email addresses from a particular domain:
<field sid="FIELD25">
     <label>E-Mail Address</label>
     <format>
          <datatype>string</datatype>
          <constraints>
             <patterns>
                  <pattern>([a-zA-Z0-9_\-\.]+)@ibm\.com</pattern>
             </patterns>
          </constraints>
     </format>
     <value></value>
</field>


Exceptions to this practice



There are no exceptions to this practice.

  • Edit
  • More Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (10)
collapsed Versions (10)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (10)Sep 29, 2011 6:31:13 PMRyan Nordman  IBM contributor
9Dec 2, 2010 1:09:48 PMJack Mitchell  IBM contributor
8Mar 31, 2010 4:29:41 PMDeanna Drschiwiski  IBM contributor
7Mar 31, 2010 4:29:02 PMDeanna Drschiwiski  IBM contributor
6Mar 31, 2010 4:27:06 PMDeanna Drschiwiski  IBM contributor
5Sep 8, 2008 1:55:04 PMDeanna Drschiwiski  IBM contributor
4Aug 8, 2008 11:49:29 AMDeanna Drschiwiski  IBM contributor
3Aug 8, 2008 10:55:33 AMDeanna Drschiwiski  IBM contributor
2Aug 8, 2008 10:55:11 AMDeanna Drschiwiski  IBM contributor
1Jul 30, 2008 12:27:36 PMDeanna Drschiwiski  IBM contributor
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use