Skip Navigation
Setting a specific format or mask for custom text fields
Answer ID 1847   |   Last Review Date 07/22/2019

When setting up a custom text field, can I require a specific format for completing the field?


Format Input Masks for Custom Fields, Phone and Postal Codes


You can define a mask to be used with custom text fields, country phone and country mail. When a mask is defined for a field, entries to that field must match the pre-defined formatting. For example, you can use a mask to specify the format used with telephone numbers or postal codes.

Within Oracle B2C Service, masks can be used when configuring any custom field that has a data type equal to a text field. When you hover over the Mask field, a pop-up displays that provides information about creating a mask.

You can define a mask in the custom text field for a specific number of characters, but you cannot define a minimum number of characters.

Masks are enforced on both the end-user pages and the administrative pages. Masks are not available on data imports.

Note: Masks are also used with the Countries/Provinces table. For each country defined in the list, you can specify a phone mask to define a format for telephone numbers used in that country and a postal mask to define the required format for postal codes.

When configuring a mask: you must use two characters to define an individual character within the field. The first character defines if the character is a fixed value (i.e. a dash or period within the string) or whether a specific case must be used (i.e. upper or lower case). The second character defines the type of character allowed, alpha, numeric, either, or any type of character.

The first character used to format a character is either F, U, L, or M:

F is used for fixed, formatted characters such as a dash or period
U is used to designate an upper case value
L is used to designate a lower case value
M is used to allow either upper or lower case (such as numbers)

The second character when defining the format of a character is either #, A, L, or C:

# indicates that a numerical value is required  
A indicates that either a number or letter is required  
L indicates that an alphabetic (letter) character is required  
C indicates that any typed character is acceptable, including numbers, letters, symbols or spaces

Telephone Number Example: Masks are commonly used to define a format to be used with telephone numbers to ensure that the area code is included with the number:

Mask: F(M#M#M#F)F M#M#M#F-M#M#M#M#
Format: (###) ###-####

Note that with this mask, the first two elements of the mask, F(, define the fixed left parenthesis. The next two elements, M#, defines a mixed-case numerical value. Since numbers do not have cases, you can use M#, U#, or L# to represent a numerical value. Between the area code and the number, you can include a space which is represented by "F " -- that is, a capital F followed by a space which represents the fixed character as a space.

Note: If you wish to include phone extensions, you can use a format similar to:

Mask: F(M#M#M#F)F M#M#M#F-M#M#M#M#F M#M#M#M#
Format: (###) ###-#### ####

However, if you include the mask for phone extensions, then you must enter an extension for each phone number entered. For numbers without an extension, you might enter a special sequence, such as 0000, to indicate that there is no extension for that number.

If you are creating masks for fields in which data already exists, please check to make sure that any special characters do not interfere with the mask formatting.  If a particular field varies in terms of length (for example, an international phone number field where the number of digits varies by country) then a mask will not be effective.

For additional information, refer to the 'Input Masks' section in the Online Help User Guide documentation for the version your site is currently running. To access Oracle B2C Service manuals and documentation online, refer to the Documentation for Oracle B2C Service Products.