Wijmo UI for the Web
maskFormat Option

Default value: ""

Determines the input mask to use at run time.

Syntax
Javascript (Usage) 
$(function () {
    
    // Get value
    var returnsValue; // Type:  string
    returnsValue = $(".selector").wijinputmask("option", "maskFormat");
    
    // Set value
    var newValue; // Type:  string
    $(".selector").wijinputmask("option", "maskFormat", newValue);
        
});
Javascript (Specification) 
var maskFormat : string;
Example
$(".selector").wijinputmask({
maskFormat: "(999)-000-0000 "
});
Value of maskFormat can also be a regex value, attentation, only the following key word supported by the regex value.
\A   ----------- Matches any upper case alphabet [A-Z].
\a   ----------- Matches any lower case alphabet [a-z].
\D   ----------- Matches any decimal digit. Same as [0-9].
\W   ----------- Matches any word character. It is same as [a-zA-Z_0-9].
\K   ----------- Matches SBCS Katakana.
\H   ----------- Matches all SBCS characters.
\A  ----------- Matches any upper case DBCS alphabet [A-Z].
\a  ----------- Matches any lower case DBCS alphabet [a-z].
\D  ----------- Matches any DBCS decimal digit. Same as [0-9].
\W  ----------- Matches any DBCS word character. It is same as [a-zA-Z_0-9].
\K  ----------- DBCS Katakana
\J  ----------- Hiragana
\Z  ----------- All DBCS characters.
[^] Used to express an exclude subset.
- Used to define a contiguous character range.
{} Specifies that the pattern.
* The short expression of {0,}.
+ The short expression of {1,}.
? The short expression of {0,1}.
The following shows some example use Regex value.
\Dundefined-\Dundefined                      Zip Code (012-3456)
℡ \D{2,4}-\D{2,4}-\Dundefined/        Phone number (℡ 012-345-6789)
\D{2,4}-\D{2,4}-\Dundefined            Phone number (012-345-6789)
Attentation, because maskFormat requrie that it uses a regex value, so assign the value as follows example.
$(".selector").wijinputmask({
maskFormat: /\Dundefined-\Dundefined/
});
$(".selector").wijinputmask({
maskFormat: new RegExp("\\Dundefined-\\Dundefined")
});
Remarks
The property can be a string composed of one or more of the masking elements as shown in the following table, 0 --------- Digit, required. This element will accept any single digit between 0 and 9. 9 --------- Digit or space, optional. # --------- Digit or space, optional. Plus (+) and minus (-) signs are allowed. L --------- Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions. ? --------- Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions. & --------- Character, required. C --------- Character, optional. Any non-control character. A --------- Alphanumeric, optional. a --------- Alphanumeric, optional. . --------- Decimal placeholder. The actual display character used will be the decimal placeholder appropriate to the culture option. , --------- Thousands placeholder. The actual display character used will be the thousands placeholder appropriate to the culture option. : --------- Time separator. The actual display character used will be the time placeholder appropriate to the culture option. / --------- Date separator. The actual display character used will be the date placeholder appropriate to the culture option. $ --------- Currency symbol. The actual character displayed will be the currency symbol appropriate to the culture option. < --------- Shift down. Converts all characters that follow to lowercase. > --------- Shift up. Converts all characters that follow to uppercase. | --------- Disable a previous shift up or shift down. H --------- All SBCS characters. K --------- SBCS Katakana. 9 --------- DBCS Digit K --------- DBCS Katakana J --------- Hiragana Z --------- All DBCS characters. \\ --------- Escape. Escapes a mask character, turning it into a literal. The escape sequence for a backslash is: \\\\ All other characters, Literals. All non-mask elements appear as themselves within wijinputmask. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user. The following table shows example masks. 00/00/0000 A date (day, numeric month, year) in international date format. The "/" character is a logical date separator, and will appear to the user as the date separator appropriate to the application's current culture. 00->L<LL-0000 A date (day, month abbreviation, and year) in United States format in which the three-letter month abbreviation is displayed with an initial uppercase letter followed by two lowercase letters. (999)-000-0000 United States phone number, area code optional. If users do not want to enter the optional characters, they can either enter spaces or place the mouse pointer directly at the position in the mask represented by the first 0. $999,999.00 A currency value in the range of 0 to 999999. The currency, thousandth, and decimal characters will be replaced at run time with their culture-specific equivalents.
Browser Compatibility
7
5
5

See Also

Reference

options type
wijinputmask jQuery Widget

 

 


© 2013 All Rights Reserved.

Send comments on this topic.