32. 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.

A number-field is used to convert a number specified using a normal, localized, format to/from a standard format. For example, the user sees and types something like "1000000000.0" in the field (pattern is "0.0#####") and the number actually stored in the XML document is "1.0E9".

[Important]

The number-field just converts a number format to another. The number-field is not used to validate what the user has typed. As always, the schema of the document is used to perform this validation. Therefore, beware that, when used with a DTD (which unlike W3C XML Schema or RELAX NG does not support data typing), a number-field allows the user to input incorrect numbers.

KeyValueDefaultDescription
attributeQualified name of attribute to be editedNo defaultWithout this parameter, the control is used to edit the value of the element for which the control has been generated.
columnsPositive integerDepends on pattern.Width of the text field in characters.
countryUpper-case, two-letter codes as defined by ISO-3166. Example: "ES".Country of default locale.Participates in specifying the locale to use.
data-typebyte | short | int | long | float | doubledoubleBase data type of attribute or element value being edited.
languageLower-case, two-letter codes as defined by ISO-639. Example: "es".Language of default locale.Participates in specifying the locale to use.
patternPattern supported by java.text.DecimalFormatA simple pattern which depends on data-type.Specifies how number is to be parsed and formatted.
variantVendor or browser-specific code. Example: "Traditional_WIN".Variant of default locale.Participates in specifying the locale to use.

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

Example:

number-field()

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

See also spinner.