ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage properties / Properties associated with windows, pages and controls
  • Numeric controls (except for the currency controls)
  • Currency controls
  • Currency + Euro controls
  • Date controls
  • Time controls
  • DateTime controls
  • Duration controls
  • Text controls in the report editor
  • Text controls in the window editor
  • Progress Bar controls
  • Type of input mask
  • Regular expressions in the input masks
  • Spreadsheet control
  • Limitations
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The InputMask property is used to:
  • get the input mask.
  • set the input mask (from the masks available for the type).
The InputMask property applies to all controls that allow input or display text:
  • an Edit control.
  • a group of Edit controls.
  • an editable Combo Box control.
  • a column in a Table control,
  • WINDEV a table column displayed by a Combo Box control.
  • a cell in a Table control,
  • a progress bar,
  • a formatted static control.
The InputMask property also applies to Calculated and Static Text controls in reports.
WEBDEV - Server code This property is only available in Read/Write for controls in a report. This property is not available for controls in pages.
Remark: The input mask of a control is defined in the window or report editor, in the "General" tab of the control description..
Input mask
For more details on the different input masks available and their characteristics, see Input mask.
Example
// Modifier le masque du champ "SAI_NomClient"
SAI_NomClient.MasqueSaisie = maskUpper
// Modifier le masque de la 1ère ligne de la table pour la colonne COL_Prix
TABLE_Table1.COL_Prix[1].MasqueSaisie = "9999,99"
// La valeur affichée tient compte du masque
Info(TABLE_Table1.COL_Prix[1].ValeurAffichée)
WINDEVUser code (UMC)
// Accepte le chiffre de 0 à 7 (octal)
MonExpression is string = "[0-7]" 
SAI_Saisie1.MasqueSaisie = "regexp:" + MonExpression
// Masque pour une jauge
JAUGE_Jauge1.MasqueSaisie = "Effectué à 999,99 %"
// Autorise la saisie d'un seul et unique chiffre compris entre 1 et 6
SAI_CHAMP.MasqueSaisie = "regexp:[1-6]{0,1}"

// Autoriser la saisie uniquement de chiffres et du caractère point, 
// 10 caractères maximum
SAI_CHAMP.MasqueSaisie = "regexp:[0-9.]{0,10}"

// Masque de saisie d'une plaque d'immatriculation française
SAI_PLAQUEIMM.MasqueSaisie = ...
	"regexp:[A-Z]{0,2}[ \-]?[0-9]{0,3}[ \-]?[A-Z]{0,2}"

// Masque de saisie sans limite de taille, 
// acceptant les chiffres et des lettres minuscules et majuscules
SAI_CHAMP.MasqueSaisie = "regexp:[0-9a-zA-Z]*"
Syntax

Getting the input mask of a control Hide the details

<Result> = <Control used>.InputMask
<Result>: Constant or character string
Input mask of the specified control. The input mask depends on the type of control. For more details, see remarks.
<Control used>: Control name
Name of the control to be used.

Changing the input mask of a control Hide the details

<Control used>.InputMask = <New input mask>
<Control used>: Control name
Name of the control to be used.
<New input mask>: Constant, character string or InputMask variable
New input mask for the specified control. This mask can correspond to:
  • A string or constant, specifying the mask to use.
    The input mask depends on the type of control. For more details, see remarks.
  • WINDEV an InputMask variable, used to manage advanced input masks on Edit controls, editable Combo Box and Table control columns.
WINDEVWINDEV Mobile In the window editor, for Edit controls and combos, you can use a regular expression to build the validation mask: simply use the string "regexp:" before the regular expression.. For more details, see remarks.
Remarks

Numeric controls (except for the currency controls)

1. Preset input masks
maskBitcoinNumeric input mask used for Bitcoins. The Bitcoin symbol is displayed.
WINDEV Mobile This constant is not available.
maskFileSizeNumeric mask for file and disk sizes.
Note: The unit change (e.g. from KB to MB) is performed for each multiple of 1024.. Therefore, the mask may display 1003 KB.
maskScientificNumeric input mask for scientific notation.
WINDEV Mobile This constant is not available.
maskSystemNumeralNumeric mask used by the system.
Corresponds to the mask defined in the system regional settings ("Regional options" in the control panel).

Examples:
// Masque Taille de fichier
SAI_Saisie1.MasqueSaisie = maskFileSize
SAI_Saisie1 = 5681234	// Affiche 5,68 Mo
// Masque Bitcoin
SAI_Saisie2.MasqueSaisie = maskBitcoin
SAI_Saisie2 = 5681234	// Affiche 0,05 681 234 B
// Masque Scientifique
SAI_Saisie3.MasqueSaisie = maskScientific
SAI_Saisie3 = 5681234	// Affiche 5,681234E+06
2. Custom input masks
Input masks are defined using the following characters: "9", ".", ",", "+" and "-", "$" and spaces.. For example: "99.999,99".
In display mode, the decimal and thousand separators as well as the symbol defined for the language are taken into account.
In the code (regardless of the language):
  • " " (space) is replaced with the thousand separator.
  • ", " (comma) is replaced with the decimal separator.
  • "$" is replaced with the currency symbol (write "$$" to avoid this substitution).
3. Specific custom input masks
  • Using the % symbol:
    Caution: Until version 90028, the value assigned to the field by programming was displayed as is, followed by the % character..
    From version 90033, the valued assigned to the control through programming is multiplied by 100 and the "%" character is displayed. To restore the operating mode of the earlier versions, write "%%" to display the % character without multiplying the value by 100.
    Example:
    • Assigning a value to the control programmatically:
      SAI_Saisie1.MasqueSaisie = "999,9%"
      SAI_Saisie1 = 0.562 // Affiche 56,2 %
      
      SAI_Saisie1.MasqueSaisie = "999,9%%"
      SAI_Saisie1 = 0.562 // Affiche 0,562 %
    • Input in the control by the user:
      • Mask 99.99%, value entered: 19.6, value displayed: 19.6%, value manipulated by programming: 0.196.
      • Mask 99.99%%, value entered: 19.6, value displayed: 19.6%, value manipulated by programming: 19.6.
  • Use of parentheses: display of negative numbers.
    Example:
    SAI_Saisie1.MasqueSaisie = "(999 999)"
    SAI_Saisie1 = -1234      // Affiche (1 234)
    SAI_Saisie1 = 1234       // Affiche 1 234
  • Use of the - sign at the end of the string: display of negative numbers (it is possible to write "--" to display the - sign at the end of the string).
    Example:
    SAI_Saisie1.MasqueSaisie = "999 999 -"
    SAI_Saisie1 = -1234      // Affiche 1 234-
  • Multiple input mask: input mask for defining the format of positives, the format of negatives, the value if 0 is used, the value if NULL is used.. The following syntax is used:
    <Format des positifs>;<Format des négatifs>;<Valeur si 0>;<Valeur si NULL>

    Example:
    SAI_Saisie1.MasqueSaisie = "999 999;-999 999;0;<NULL>"
    SAI_Saisie1 = -1234      // Affiche - 1 234

    Note: You can specify a color by using [<Couleur>] next to the desired mask.. <Color> can correspond to:
    • to one of the following constants: Red, Green, Blue, Black, White, Yellow, Orange.
    • a hexadecimal value in "#BBGGRR" format.
      Example:
      SAI_Saisie1.MasqueSaisie = "999 999;-999 999[Rouge];0;<NULL>"
      SAI_Saisie1 = -1234      // Affiche - 1 234 en rouge
      
      SAI_Saisie1.MasqueSaisie = "999 999;-999 999[ #FF0000];0;<NULL>"
      SAI_Saisie1 = -1234      // Affiche - 1 234 en bleu

      Note: The color specified in the input mask takes precedence over the Color property.. It is ignored if the control is grayed.
Remarks:
  • Using 0 in the input mask:
    • If you want to pad the number with zeros on the left, use "0" on the left of the mask. For example:
      SAI_Saisie1.MasqueSaisie = "099.999,99"
      SAI_Saisie1 = 23,50 // Affichera 023,5
    • If you want to pad the decimal part of the number to with zeros, use "9" to the right of the decimal point. For example:
      SAI_Saisie1.MasqueSaisie = "9999,000"
      SAI_Saisie1 = 12 // Affichera 12,00
      SAI_Saisie1 = 12,368 // Affichera 12,368 (la valeur n'est pas arrondie)
  • To force the signs, use the "+" character on the left. For example: "+9999"..
  • WINDEV You also have the ability to specify hexadecimal input masks (between 0xF and 0xFFFFFFFFFFFFFFFFF).

Currency controls

The input masks have the same type as the numeric masks. The difference lies in precision: the monetary units have 17 significant digits for the integer part and a maximum of 6 decimal places.
For example: "99 999 999 999 999,999999".
Note: A predefined mask can also be used for Monetary type fields:
maskSystemCurrencyCurrency mask used by the system. Corresponds to the mask defined in the system regional settings ("Regional options" in the control panel).

Currency + Euro controls

The input masks have the same type as the currency masks. The dollar character ("$") can be added into the mask to display the current currency.
For example: "$999.99" will display "250.25 F" if the current currency is the franc.

Date controls

The input masks for Date controls are:
  • "DD/MM/YYYY"
  • "DD/MM/YY"
  • "DDD DD"
  • "MM/DD/YYYY"
  • "MM/DD/YY"
  • "YYYY/MM/DD"
  • "YY/MM/DD"
  • "DD/MM/YYYY HH:MM:SS"
  • "MM/DD/YYYY HH:mm:SS"
  • "DD/MM/YYYY HH:mm:SS:CCC"
  • "MM/DD/YYYY HH:mm:SS:CCC"
  • "DDDD DD MMMM YYYY"
  • "Dddd DD Mmmm YYYY"
  • "Dddd DD Mmm YYYY"
  • DD (corresponding to the day of the week in figures, e.g. 12)
  • "DDDD" (corresponding day of the week, e.g. "Thursday"). The case used depends on the language options of the project.
  • "DDDD" (corresponding to the day of the week with the first letter capitalized, e.g. Monday)
    Java This notation is not available.
  • "dddd" (corresponding to the day of the week with the first letter forced into lower case, e.g. Monday)
    Java This notation is not available.
  • "DDD" (abbreviation for the day of the week, "Thu" for example). The case used depends on the language options of the project.
  • "DDD" (abbreviation for the day of the week with the first letter capitalized, e.g.: Mon)
    Java This notation is not available.
  • "ddd" (abbreviation for the day of the week with the first letter forced into lower case, e.g.: mon)
    Java This notation is not available.
  • MM (month in figures, e.g. 12)
  • "MMMM" (non-abbreviated month, for example "January"). The case used depends on the language options of the project.
  • "Mmmm" (month spelled out with the first letter capitalized, e.g. January)
    Java This notation is not available.
  • "mmmm" (month in all letters with the first letter forced into lower case, e.g. January)
    Java This notation is not available.
  • "MMM" (abbreviation of the month, "Jan" for example). The case used depends on the language options of the project.
  • "Mmm" (month abbreviation with the first letter capitalized, e.g. Jan)
    Java This notation is not available.
  • "mmm" (month abbreviation with the first letter forced into lower case, e.g. jan)
    Java This notation is not available.
  • "YYYY" (year on four digits, "2001" for example)
  • "YY" (last two digits of the year, "01" for example)
  • the date defined by the project.
    The date defined by the project depends on the date format selected in the parameters of the project language:
    • on the "Project" tab, in the "Project" group, click "Description".
    • display the "Languages" tab then the language options regarding the date.
These masks can be combined. For example: "On DD DD Mmmm YYYY at HH:mm" will give a result of the form "On Thu Feb 01 1979 at 21:35".

Time controls

The input masks for the time controls are:
  • "HH:MM".
  • "HH h MM".
  • "HH:MM:SS".
  • "HH:MM:SS AM": Used to manage time in AM/PM format.
  • "HH:MM:SS:CC".
  • The preset mask corresponds to the system time. The system time depends on the mask selected in the regional system setings ("Regional options" in the control panel).
    maskSystemTimeMask used by the system for the time.

DateTime controls

To specify a DateTime input mask, you must:
  1. Switch the type of the control (or table column) to Date ("Details" tab in the description window of the control or column).
  2. Change the input mask of this control or column ("Details" tab in the control or column description window, or InputMask property).

Duration controls

The following elements can be used to define a custom mask (case sensitive). To present the custom masks, let's take a duration equal to 0 day 04 hours 15 minutes 03 seconds and 412 thousandths of a second:
  • +1: only the most significant unit is displayed (in our example, only the number of hours).
  • +2: only the two most significant units will be displayed (in our example, only the number of hours and the number of minutes)..
    Specify '+3' or '+4' to display the three or four most significant units.
  • J: the number of days will be displayed if this number is greater than 0 (in our example, the number of days will not be displayed).
  • H: the number of hours will be displayed if this number or the number of days is greater than 0.. If this number contains a single digit, this digit will be displayed (the number of hours will be '4' in our example).
  • HH: the number of hours will be displayed if this number or the number of days is greater than 0.. If this number contains a single digit, this digit will be preceded by '0' (the number of hours will be '04' in our example).
  • M: the number of minutes will be displayed if this number or the number of a longer duration (number of days or hours) is greater than 0.. If this number contains a single digit, this digit will be displayed (the number of minutes will be '15' in our example).
  • MM: the number of minutes will be displayed if this number or the number of a longer duration (number of days or hours) is greater than 0.. If this number contains a single digit, this digit will be preceded by '0' (the number of minutes will be '15' in our example).
  • S: the number of seconds will be displayed if this number or a longer number (days, hours or minutes) is greater than 0.. If this number contains a single digit, this digit will be displayed (the number of seconds will be '3' in our example).
  • SS: the number of seconds will be displayed if this number or a longer number (days, hours or minutes) is greater than 0.. If this number contains a single digit, this digit will be preceded by '0' (the number of seconds will be '03' in our example).
  • CC: the number of hundredths of a second will be displayed (in our example, the number of hundredths of a second will be '41').
  • CCC: the number of thousandths of a second will be displayed (in our example, the number of thousandths of a second will be '412').
Note: If the separator corresponds to the ":" character, the letter corresponding to the most significant unit will be added (letter 'h' for hour, 'm' for minute, 's' for second, 'cs' for hundredths of a second and 'ms' for thousandths of a second).
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadIOS Widget

Text controls in the report editor

The masks defined in the report editor are as follows ("General" tab of the control description):
maskFUpperFirst letter capitalized.
maskLowerAll in lowercase characters.
maskUpperAll in uppercase characters.
WINDEVJavaUser code (UMC)

Text controls in the window editor

  • The preset masks
    These masks are defined in the window editor ("General" tab of the control description).
    maskAAlphaNumLetter, then letters + digits.
    maskAAlphaNumUpperUppercase letter, then uppercase letters + digits.
    maskAddressIPIP address in IPV4 format (example: 192.168.2.3).
    maskAddressIPv6IP addresses in IPV6 format: aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh:iiii:jjjj
    maskAddressMACMAC address in the following format: "aa:bb:cc:dd:ee:ff".
    maskAlphaLetters.
    maskAlphaNumLetters + digits.
    maskAlphaNumUpperLetters in uppercase characters + digits.
    maskAlphaUpperLetters in uppercase characters.
    maskBankAccountNumberIBAN bank account number: two letters (country code) + two digits (control key) + 11 to 30 digits/letters.
    maskCardNumberAmericanExpress15-digit American Express credit card number.
    maskCardNumberMasterCard16-digit Mastercard credit card number.
    maskCardNumberVISA16-digit Visa credit card number.
    maskEmailEmail address.
    maskEmailMultipleEmail addresses separated by the ";" character.
    maskEmailRFC2822Email address that is RFC2822 compliant and uses a correct top level domain, checked when exiting the control.
    maskEmailRFC2822MultipleEmail addresses separated by the ";" character. These email addresses are RFC2822 compliant and use a correct top level domain.
    maskFileNameFile name and path.
    maskFileNoFolderFile name (without its directories).
    maskFUpperFirst letter capitalized.
    maskINSEEINSEE number.
    maskINSEEKeyINSEE number + key.
    maskISBN1010-digit ISBN number.
    maskISBN1313-digit ISBN number.
    maskLowerAll in lowercase characters.
    maskNoneNo input mask.
    maskNumDigits.
    maskNumPlusDigits, '+', ' ', '.', '-', ','
    maskPatronymicLetters + Digits + Space + Apostrophe + Dash.
    maskPatronymicUpperUppercase Letters + Digits + Space + Apostrophe + Dash.
    maskPersonID_AustraliaAustralian social security number (Tax File Number - TFN).
    maskPersonID_BelgiumBelgium social security number (National number).
    maskPersonID_BrazilBrazilian social security number (Cadastro de Pessoas fisicas).
    maskPersonID_CanadaCanadian social security number (Social insurance number).
    maskPersonID_GreeceGreek social security number (Identity card).
    maskPersonID_ItalyItalian social security number (Codice fiscale).
    maskPersonID_NetherlandsDutch social security number (Sofinummer).
    maskPersonID_SingaporeSingaporean social security number (National Registration Identity Card).
    maskPersonID_SpainSpanish social security number (Numero de identificacion de Extranjeros).
    maskPersonID_UKBritish social security number (National Insurance Number).
    maskPersonID_USAmerican social security number (Social Security Number).
    maskPhonePhone number
    maskPhoneBelgiumBelgium phone number (dial codes, national and international numbers).
    Android This constant is not available.
    maskPhoneCanadaPhone number in Canadian or American format (XXX CCC-CCCC or +1 XXX CCC-CCCC where XXX corresponds to the regional code and CCC-CCCC to the local number).
    Android This constant is not available.
    maskPhoneFranceFrench telephone number (10 digits, grouped by 2). For example: "04 67 69 40 23" or "36 99".
    maskPhoneSwitzerlandSwiss phone number (0CC CCC CC CC or +41 CC CCC CC CC).
    Android This constant is not available.
    maskRIBRIB number.
    maskRomanNumeralRoman number (e.g. MCMLXXIV).
    maskSIRENCompany SIREN number: 9-digit number made up of eight digits + a control code (on one digit) calculated using the Luhn algorithm.
    maskSIRETSIRET number of an establishment: this is a SIREN number followed by 4 digits + a control code (on one digit) calculated according to the Luhn algorithm.
    maskUpperAll in uppercase characters.
    maskUUID128128-bit UUID without dashes. For example: "29ea9852143a46a4842aca811e5f8597".
    maskUUID128Raw128-bit UUID with dashes. For example:
    "29ea9852-143a-46a4-842a-ca811e5f8597".
    maskUUID128WithBrace128-bit UUID with braces. For example:
    "{29ea9852-143a-46a4-842a-ca811e5f8597}".
    maskUUID256128-bit UUID without dashes. For example:
    "c5c9b31729278ad9da1efc44c437b7d85 b57060f41e2bf4d0e112eadb77a6d0b".
    maskZipCodeFrench postal code (including DOM): 5-digit number.
    maskZipCodeAustraliaAustralian postal code.
    maskZipCodeAustriaAustrian postal code.
    maskZipCodeBelgiumBelgium postal code.
    maskZipCodeBrazilBrazilian postal code.
    maskZipCodeCanadaCanadian postal code.
    maskZipCodeGermanyGerman postal code.
    maskZipCodeGreeceGreek postal code.
    maskZipCodeItalyItalian postal code.
    maskZipCodeNetherlandsDutch postal code.
    maskZipCodePortugalPortuguese postal code.
    maskZipCodeSingaporeSingapore postal code.
    maskZipCodeSpainSpanish postal code.
    maskZipCodeSwitzerlandSwiss postal code.
    maskZipCodeUKUK postal code.
    maskZipCodeUSUS zip code.
  • The custom masks
    These custom masks are described with the following characters:
    • "9": Isolated digit
    • "C": Digit or space
    • "L" (capital letter L): Capital letter
    • "l" (lowercase letter L): Lower-case letter
    • "A": Upper-case alphanumeric character
    • "a": Lower-case alphanumeric character
    • "?": Any character
Any other character is reproduced as it is. Therefore, the masks are never wrong.

Note: It is possible to describe a Numerical mask in a Text field.. The value retrieved will be a numeric character string and not a numeric value.
For example: For a license plate: LL 999 LL.
WINDEVJavaUser code (UMC)

Progress Bar controls

In a Progress Bar control, the input mask is used to define the formatting of the text displayed in the progress bar. The mask used by default is "999,9 %". You have the ability to use the custom masks available for a Text control.

Type of input mask

Caution: Changing a mask can only be done with an mask of the same type.. For example, the input mask of a DATE control cannot be replaced with the input mask of a TIME control.
Assigning an incorrect input mask will trigger an error message.
WINDEVWEBDEV - Server codeReports and QueriesAndroidJavaUser code (UMC)Ajax

Regular expressions in the input masks

The regular expressions used in this property must not be the ones used in MatchRegularExpression.
In input masks, regular expressions prevent the input of certain characters or sequences of characters.
In MatchRegularExpression, regular expressions are used to check the string format.
Example: Check that the string T1 contains a letter and a number:
  • with the MatchRegularExpression function: the regular expression used is [A-Za-z][0-9]
  • with InputMask: the regular expression used is [A-Za-z]{0,1}[0-9]{0,1}
WINDEV

Spreadsheet control

The mask of a cell found in a Spreadsheet control can be defined by SpreadsheetTypeAndMaskSelection. The InputMask property is used to change the defined input mask (the cell type is not modified).

Limitations

WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadIOS Widget In a report, the InputMask property can only be used on:
  • a calculated control,
  • a preset control,
  • a Static Text control.
WINDEVWINDEV Mobile In a window, the InputMask property applies only to:
  • edit controls,
  • table columns,
  • WINDEV table columns displayed by a Combo Box control.
  • editable combo boxes,
  • groups of edit controls,
  • table cells.
WEBDEV - Server code This property is only available in Read / Write for controls in a report. This property is not available for controls in pages.
Java In Java, the InputMask property applies only to the following elements:
  • Edit control.
  • Combo Box.
  • Table column.
Related Examples:
The regular expressions Unit examples (WINDEV): The regular expressions
[ + ] Using regular expressions with WINDEV.
Two use modes are presented for the regular expressions:
- checking the input format
- checking out different elements while respecting the input format.
This example is also used to search for a word in a string. The search can be case-sensitive or not. Possibility to take into account (or not) the start or end of string, as well as spaces (anywhere in the string, even in the sought word)
Advanced input mask Unit examples (WINDEV): Advanced input mask
[ + ] Handling the input masks in WINDEV:
- Defining the format of positive/negative number in a numeric edit control
- Defining how negative numbers will be displayed in a numeric edit control
- Defining how the value 0 will be displayed in a numeric edit control
- Using a regular expression to prevent from typing characters other than 1, 2, 3, 4, 5 and 6.
- Using a regular expression to "regulate" the input of a French registration number
The regular expressions Unit examples (WINDEV Mobile): The regular expressions
[ + ] Using regular expressions with WINDEV Mobile.
It presents 2 modes for using the regular expressions:
- check the input format
- check out the different elements that match the input format.
This example is also used to search for a word in a string. The search can be case-sensitive or not. Possibility to take into account (or not) the start or end of string, as well as spaces (anywhere in the string, even in the sought word)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help