Thursday, July 25, 2013

Simplifying the list of data types in Form Builder

Form builder always had the ability to validate data using data types such as "string", "integer", "decimal", "date", "email", and so on.

Most (but not quite all) of the types available in Form Builder until now come from an XML specification called "XML Schema". When we first implemented this feature in form builder many years ago, we simply took the list of types from that specification!

The problem is that many, in fact most of the types in that list don't make much sense for end users, with names such as "NMTOKENS" that even programmers have trouble figuring out.

What we had done initially to alleviate that was to try to put the most common types at the top. But for Orbeon Forms 4.3, we took a closer look at this and did the right thing: remove all the unneeded types (see the screenshot for the new list).

We have for now kept the few variants on the "integer" type, such as "Positive Integer". These are convenient, although they should be available for all number types, not only integers.

While doing this we have also thought about the "double" number type. The problem with this data type is that it is represented by software in binary form, and that the numbers entered by users are decimal numbers. When converting from one type to the other, there is often a loss of information, which becomes particularly visible when numbers are for example added together.

It is in fact very rare outside of scientific work to need doubles, and you should generally use decimal numbers instead. 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.

No comments:

Post a Comment