NumericFormElement

A NumericFormElement writes an <input> element with a type="text" to the output. It uses the JQuery autoNumeric plugin to support decimal precision, localization and adding symbols (eg. for currency).

Element and builder

The ViewElement implementation is NumericFormElement and has an equivalent NumericFormElementBuilder. A builder can be created using BootstrapViewElements.bootstrap.builders.numeric() factory methods.

NumericFormElement attributes

Attribute Description Default

NumericFormElementConfiguration

See NumericFormElementConfiguration for configuration options.

Not set by default

Examples

Creating a basic numeric form element

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders.numeric()
        .simple()
        .build();

Creating an integer number form element

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders.numeric()
        .integer()
        .build();

Creating a decimal number form element

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders.numeric()
        .decimal(2)
        .build();

Creating a percentage number form element

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders.numeric()
        .percentage()
        .build();

Creating a currency number form element

Given the following builder configuration

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders.numeric()
        .currency( Currency.getInstance("EUR"))
        .build();