NumberField widget enables the creation of input fields that should contain a numeric value. It also provides formatting facilities to handle numeric and currency patterns.

The whole list of configuration parameters is available in NumberFieldCfg bean.

Formatting patterns

You can use formatting patterns to specify how a number should be conventionally displayed, even as a currency. It can be defined as a combination of the following:

Symbol Location Meaning
0 Number Digit
# Number Digit, zero shows as absent
. Number Decimal separator
, Integer Grouping separator
ยค (\u00A4) Prefix or suffix Currency sign, replaced by currency symbol.

The supported patterns are a subset of the java.text.DecimalFormat specs. More information are available at localization_and_resources.

Sample usage

The following sample shows how to create and use a NumberField widget, with a mandatory attribute for error checking and number format patterns. In order to fetch the entered value, variable binding is to be considered as the preferred solution. Please refer to the textfield widget for more informations.

In this sample, the first 3 NumberFields are the same except for the state, which is respectively mandatory, normal and disabled. The fourth NumberField has a pattern, that is used both to interpret and display the number.

More information about the pattern are available at Localization and Resources.