numberField

Basics

An example of numberField:

<numberField clearButtonVisible="true"
             value="234.433"/>
number field basics
numberField doesn’t handle formatting. Use TypedTextField when you need localized number formatting or support for different data types.

Data Binding

Data binding refers to linking a visual component to a data container. Changes in the visual component or corresponding data container can trigger updates to one another. See Using Data Components for more details.

The following example produces a data-aware numberField. The entity attribute must be of a numeric type.

<data>
    <instance class="com.company.onboarding.entity.Step" id="stepDc">
        <fetchPlan extends="_base"/>
        <loader id="stepDl"/>
    </instance>
</data>
<layout>
    <numberField dataContainer="stepDc" property="factor"
                 step="0.5" stepButtonsVisible="true"/>
</layout>
number field data binding

Validation

To check values entered into the numberField component, you can use a validator in a nested validators element.

The following predefined validators are available for numberField:

XML Element

validators

Predefined validators

custom - doubleMax - doubleMin - negative - negativeOrZero - notNull - positive - positiveOrZero

See Also

See the Vaadin Docs for more information.