26. number-field
Prev | Chapter 5. Content objects | Next

## 26. number-field

number-field(`key`, `value`, ..., `key`, `value`)

Inserts in generated content a text field control, configured for parsing and formatting numbers. This control can be used to edit the value of the element which is the target of the CSS rule. If "attribute, `attribute_name`" is specified, this control can be used to edit the value of an attribute of this target element.

It is important to understand that a number-field does not validate what the user types in it. It is the schema of the document which is used for that. The number-field is just useful to convert formatted numbers (example: 1,000,000.00) to/from the standard numbers (example: 1000000.0) which are stored in the document. In practice, this means that a number-field is unusable with DTDs which, unlike W3C XML Schema and Relax NG, cannot validate numbers.

Key | Value | Default | Description
--- | --- | --- | ---
attribute | Qualified name of attribute to be edited | No default | Without this parameter, the control is used to edit the value of the element for which the control has been generated.
pattern | Pattern supported by java.text.DecimalFormat | A simple pattern which depends on data-type. | Specifies how number is to be parsed and formatted.
language | Lower-case, two-letter codes as defined by ISO-639. Example: "es". | Language of default locale. | Participates in specifying the locale to use.
country | Upper-case, two-letter codes as defined by ISO-3166. Example: "ES". | Country of default locale. | Participates in specifying the locale to use.
variant | Vendor or browser-specific code. Example: "Traditional_WIN". | Variant of default locale. | Participates in specifying the locale to use.
data-type | byte | short | int | long | float | double | double | Base data type of attribute or element value being edited.

`Key`, `value`, ..., `key`, `value` may also specify style parameters.

Example:

    number-field()

    number-field(data-type, float,
                 pattern, "0.0#####",
                 language, en,
                 country, "US")

Prev | Up | Next
25. list | Home | 27. radio-buttons