It’s a very simple UI widget to restrict integer and double input into regular TextField. At this moment, it works powerfully with just two types.
Integer type just allows digits (0-9) and negative signal (-) at the beginning.
Double type allows digits (0-9), negative signal (-) at the beginning, and decimal separator. The decimal separator used is the same of application locale, if you need to change it, use application setLocale().
Features:
- Integer and Double restrict numerics characteres.
- Double complete with decimals until scale defined
(e.g. [scale=4] “10.12” → “10.1200”) - Double fills the field without decimal separator
(e.g. [scale=2] “10” → “10.00”). - Double put a zero at the beginning if the user leave it without
(e.g. “.12” → “0.12”) - Double removes* excessive decimals
(e.g. [scale=2] “10.8987” → “10.89”) - Accepts validator to certify the value at server side.
- Default Double/Integer validator preconfigured - see on code example.
- Removes, not rounds the value.
In future, we’ll be better:
- Per mille sign.
- Currency symbol.