Number Validator

The purpose of the number validator is to verify that the content of cell is a number and to format the provided numeric value. The number format used may depend on the value of the table cell. For example, you can render positive values as green and negative values as red:

images/wiki/download/attachments/44696019/Screenshot-38.png

Warning message is displayed at the bottom of the cell if the cell value is not a number:

images/wiki/download/attachments/44696019/Screenshot-57.png

Confluence administrators specify the format to use in the Validator Text field of the configuration page:

images/wiki/download/attachments/44696019/Screenshot-37.png

The format can be a plain text format, such as ' 0,0.000' or a JSON array with a list of formats. Every element of the array shall be a JSON object with the following properties:

Property

Description

format

A format string to use. For a detailed format string description please refer to the numeraljs documentation. This property is mandatory

style

A CSS style to apply. For a list of applicable styles please refer to the HTML table styles documentation. This property is optional

group-separator

If you use group separator other then comma you can specify your preferred group separator in this option. This property is optional

lt

Less-than condition. Apply format only if the condition is true. This property is optional

lte

Less-than-or-equal condition. Apply format only if the condition is true. This property is optional

gt

Greater-than condition. Apply format only if the condition is true. This property is optional

gte

Greater-than-or-equal condition. Apply format only if the condition is true. This property is optional

eq

Equal condition. Apply format only if the condition is true. This property is optional

Example:

[
{
"lt": 0,
"format":"0,0.00",
"style": { "text-align": "right", "color": "red" },
"group-separator": "\u00a0"
},
{
"gte": 0,
"format":"0,0.00",
"style": { "text-align": "right", "color": "green" },
"group-separator": "\u00a0"
}
]