Skip to content

Number Mask Characters

Masks can be set for numeric fields to require a certain format or certain characters for a specific number type. For example, a mask may be set for a phone number field to require three digits between a set of parentheses for the area code, three digits before a hyphen, and four digits after the hyphen.

When specifying number masks in JustWare code tables, several characters may be used to achieve the desired mask results. These characters specify whether an input is required or optional, as well as which characters are allowed for the input.

Mask Character Description
& Any keyboard character is allowed. An entry is required.
# Any numeric digit is allowed. An entry is required.
A Any letter of the alphabet or numeric digit is allowed. An entry is required.
C Any keyboard character is allowed. Entry is optional.
? Any letter of the alphabet is allowed. Entry is optional.
9 Any numeric digit is allowed. Entry is optional.
a Any letter of the alphabet or numeric digit is allowed. Entry is optional.
\ Escapes special characters when placed before the special character for example \# would escape the # character ensuring that character would show properly.

Tip: Any character used in a numeric mask that is not a special mask character is inserted into a numeric input. For example, a dash (-) is not a special mask character. If a dash is used in a numeric mask (phone number or 9-digit ZIP Code), the dash is input automatically in the specified location when a user types a numeric input. Additionally, if more than one mask exists for a specific number, one of which includes a character that is not a special mask character, JustWare selects the correct mask to use when the user types the specified character in the correct location.

Note: JustWare versions 5.x and later do not allow the setting of masks for ZIP codes and phone numbers through code tables, and masks for these must be set through the JWXML. Contact Journal Technologies Support for assistance.

ZIP Code Mask Example

A ZIP code is generally in one of two formats:

  • 12345
  • 12345-6789

In JustWare, a mask can be created for each format:

  • #####
  • #####-####

JustWare uses the mask that most closely matches the user input. In the above example, the first mask is used until the user types a dash (-) or a sixth digit, then JustWare uses the second mask. The user input must match one mask or the other.

Phone Number Mask Example

Phone numbers are often specified in several formats, with or without an area code (specified with parentheses) and an extension (specified with the letter "x"):

  • 123-4567
  • (123)456-7890
  • 123-456x7890
  • (123)456-7890x1234

In JustWare, a mask can be created for each format:

  • ###-####
  • (###)###-####
  • ###-####x#999
  • (###)###-####x#999

Tip: The extensions specified in the above example require at least one digit (indicated by the pound # sign after the "x") but allow for a possibility of four digits (indicated by the pound # sign and the 9s). JustWare uses the mask that most closely matches the user input. In the above example, the first mask is used unless the user types a parenthesis, the letter "x," or types more than seven digits. At that point, JustWare selects the next most applicable mask. The user input must match at least one mask.