More dynamic control bindings in Form Builder

Recently, a user asked us why, in Form Builder, there is a separate Number control in the toolbox. Is this the same as an Input Field set it to a Decimal datatype?

Our answer was, unfortunately: "Not really!". When you add a Number control, you are in fact adding an fr:number XBL component, which is able to format numbers back and forth with customizable decimal and grouping separators, and to top it off supports a prefix and suffix. In short, it has more features than just a plain input field, and it is part of a set of so-called typed controls.

Form Builder Typed Controls
Obviously, that situation is not ideal, as there are two incompatible ways of inserting a number field in From Builder!

For the longest time we have wanted to have fully dynamic XBL bindings, depending on datatypes. This is a task that we haven't yet completed.

But it occurred to us that we could already go one step in the right direction, by providing this functionality at the Form Builder level. And this is possible because Form Builder knows about datatypes at design time.

So that's just we have done and now from a user's perspective the Number control in the toolbox is just a shortcut for inserting an Input Field with Decimal datatype, as you would have expected.

What's even better is that we now have a general underlying mechanism to support this type of mappings. At the low level, we simply say that the XBL fr:number component must be used when we actually have a plain fr:number element in the form, or an xf:input bound to a decimal datatype. We express this with a CSS selector:
<xbl:binding element="fr|number, xf|input:xxf-type('xs:decimal')">
(We implemented a full CSS 3 selector parser along the way!)

This change will be available in the upcoming Orbeon Forms 4.4.