Wednesday, January 20, 2016

Removing the "double" datatype

A while back, we explained how and why we greatly simplified the list of data types in Form Builder, and we wrote:
We have reflected this in Form Builder by putting the decimal type at the top and the double type at the bottom, and we might even remove it altogether in the future.
Lately, as we were working on improvements to the Number field, we gave a bit more thought to the "double" type (AKA "double-precision floating point") and have decided that it was finally time to remove it from the data type list as well! So here is the new list:



For compatibility reasons, the list still shows "Double-precision floating point" for existing controls with that data type, but not otherwise. So the "double" data type keeps working as it did in the past, but form authors are strongly discouraged from creating new controls with it.

If you are using the "double" data type, we recommend that you think about whether you really need it. In general you should use the "decimal" type instead. One thing is certain: don't use doubles to represent currency amounts!

This change will be available in Orbeon Forms 4.11.

Wednesday, January 13, 2016

Better numeric input on mobile

Orbeon Forms has a Number field which allows you to enter integer or decimal numbers, but until now this field didn't particularly help users enter numbers efficiently on a smartphone or tablet without a physical keyboard.

But we thought we could do better, since iOS has the ability to show a numeric keypad when only the digits 0 to 9 are allowed, and, alternatively, to show the "numbers and punctuation" keyboard pane if digits are expected but other characters are needed as well (such as a decimal point). This is available even to mobile web apps, so the Number fields now does some magic and toggles these keyboards as needed!

When we know that the number field only accepts non-negative integer numbers, we show the numeric keypad:



In other cases, we show the "numbers and punctuation" keyboard pane:



There is a little trick: how do we know whether the number is restricted to integers, or cannot be negative? Until now we couldn't express these constraints nicely, but we have now added new common constraints called "Positive or Zero" and "Maximum Fractional Digits":


These common constraints not only help toggle the proper keyboard, but also, of course, validate the data appropriately.

It turns out that the implementation was not as simple as you might think, but we figured it out so you don't have to and now you can have much more efficient numeric input on mobile devices!

This enhancement will be available in Orbeon Forms 4.11.