Doublebox
- Demonstration: Doublebox
- Java API: org.zkoss.zul.Doublebox
- JavaScript API: zul.inp.Doublebox
Employment/Purpose
An edit box for holding an float point value (double).
Common Use Cases
- Scientific or financial data entry — collecting floating-point measurements, prices, rates, or percentages where integer precision is insufficient.
- Form validation — combine with the
constraintattribute (no negative,no zero,no empty) to enforce business rules without server round-trips. - Locale-aware number display — use the inherited
formatattribute (e.g."#,##0.##"or"locale:de-DE") to render the value according to the end-user’s locale. - Inline editing in grids — place inside a
<row>or a grid cell renderer for compact, type-safe numeric editors.
Example
<doublebox value="2.3"/>
Properties
Value
Default Value: null
Sets or returns the numeric value held by this doublebox as a Double object. The value may be null unless a no empty constraint prevents it. Assign a numeric literal directly in ZUL:
<doublebox value="2.3"/>
When binding via MVVM, use EL to connect a Double property on your ViewModel:
<doublebox value="@bind(vm.price)"/>
Constraint
You could specify what value to accept for input controls by the use of
the constraintproperty. It could be a combination of no positive,
no negative, no zero, no empty.
To specify two or more constraints, use comma to separate them as follows.
<doublebox constraint="no negative,no empty"/>
If you prefer to display different message to the default one, you can append the error message to the constraint with a colon.
<doublebox constraint="no negative: it shall not be negative"/>
Notes:
- The error message, if specified, must be the last element and start with colon.
- To support multiple languages, you could use the 「l」 function as depicted in the Internationalization chapter.
<doublebox constraint="no negative: ${c:l('err.num.negative')}"/>
Supported Events
- Inherited Supported Events: NumberInputElement
Supported Molds
Available molds of a component are defined in lang.xml embedded in zul.jar.
| Name | Snapshot |
|---|---|
| default | ![]() |
| rounded | ![]() |
Supported Children
*NONE
Inherited Functions
Please refer to NumberInputElement for inherited functions.

