Thursday, January 31, 2013

New sample form: W-9

We just added a new sample form as part of our process of testing Orbeon Forms 4.0 beta builds. This is the W-9 form, which is a common US form to request a taxpayer identification number.

In the browser
It shows a number of features, including:

  • the (new in 4.0) wizard view
  • how to show and hide controls depending on conditions
  • how to fill-out a PDF from a template

PDF version
You have a lot of freedom when bringing a form to the web from a paper (PDF) version: adapt the fields, general organization of the form and workflows to help the user make choices quickly!

Tuesday, January 29, 2013

Orbeon Forms 4.0 Beta 3

Today we released the third Beta release of Orbeon Forms 4.0! Like 4.0 Beta 2 and the previous milestone builds this is not a final release.

In this release, we fixed some more IE 7 issues, improved Section Templates, the Wizard, and XML Schema generation, and more. Here is the overall list of changes since Beta 2:
  • Form Builder
    • StackOverflowError when inserting section template with repeat (#725)
    • xxforms:get-request-parameter() doesn't work in Validation Details (#742)
    • Validation Properties: XPath validation uses wrong namespaces (#743)
    • Crash with XBL containing a bind with id (#770)
  • Form Runner
    • Wizard: fix event handler showing first relevant section (453f257d5a)
    • IE: Autocomplete menu closes almost immediately (#734)
    • IE7: Summary page: search field too wide (#735)
    • On IE, on `xf:setfocus`, client tells the server again the focus has been set (#747)
    • Exception with form using the dialog editor (#760)
    • Repeat in section template: controls resources are not included (#757)
    • Section template with repeat doesn't write data back (#740)
    • Issue when generating the PDF for a form with hidden sections (#756)
    • PDF: CSS fixes (93f78aaddd)
    • Wizard: shows non-valid section when invalid value is non-relevant (#778)
    • Wizard: CSS fixes (0867a2978e)
    • Schema generation failing when using the MySQL persistence layer (#772)
    • Schema generation outputs items from itemsets (b63a25bc19)
    • xxf:default doesn't run in section template (#786)
    • The resource persistence layer raises an error when saving XML documents (#737)
  • XForms engine
    • Event handler with incorrect `ev:observer` associates with parent (#739)
    • NPE in xf:load with AVT (#746)
    • Data type not applied as CSS attribute to xf:input inside a xf:group (#659)
    • xxf:default result is ignored in XBL mirror instance (#787)
    • xf:recalculate: support xxf:defaults="true" with xxf:deferred="true" (34471c392d)
  • Other
    • Upgrade to Ehcache 2.6.3
    • Upgrade Saxon with backported Numberer_it (fixes Unicode for Italian numbers, dates and times)
More information is available in the in-progress release notes for 4.0.

You can download the builds using these links:
Don't forget to grab a trial license for the PE version.

Please send feedback:

Friday, January 18, 2013

Better formulas with XPath type annotations

With XForms, you use XPath expressions to specify complex validation constraints and calculations. Take the following XML snippet:
You can declaratively calculate the total like this:
<xf:bind ref="total" calculate="../units * ../price"/>
../units and ../price are paths that refer to the XML elements with those names. This is much like a good old spreadsheet formula, except you are not working on cells but on XML data.
Because there is a multiplication with *, each side is atomized by the XPath evaluator. This means that the expression engine looks at the XML elements and extracts a value from them. This makes sense, because you can’t multiply two elements, you can only multiply two numbers!
But there is a twist, because multiplication is defined on different kinds of numbers: in XPath, you can in particular multiply integers, floating-point numbers, and decimals. In this example, what does the XPath evaluator do? Well, by default, it looks at each number as a double-precision floating-point number (double).
And this is not always what you want. For example, when dealing with currencies, you really want decimal numbers in order to avoid funny rounding errors. In this case, you must use casts, which make the expression more complicated:
<xf:bind ref="total"
  calculate="xs:decimal(../units) * xs:decimal(../price)"/>
Now XForms also allows you to assign types to XML data:
<xf:bind ref="units, price, total" type="xs:decimal"/>
This annotates all three elements with the xs:decimal type, with the meaning that the value is required to conform to that type. It’s designed so that if the user, via an input field, enters an incorrect value, or fails to enter a value, that value will be marked as invalid. [1]
But with XForms prior to version 2, XPath expressions were not aware of these annotations. This is understandable, because formally XForms only specified support for XPath 1.0, which had a limited set of data types (string, number, and boolean), and which didn’t specify how annotations on a data model should work.
The good news is that XForms 2 officially supports XPath 2 [2], and this gives the XPath evaluator an opportunity to use type annotations properly. So, with the examples given above, the calculate expression, when looking at the values of the units and price elements, can notice that they have an xs:decimal type, and handle them properly as decimal values. The expression remains as lightweight as it was without annotations:
<xf:bind ref="total" calculate="../units * ../price"/>
You might wonder what happens if the value is not of the specified type. Say you have:
The answer is that when the XPath evaluator tries to access the typed value of price, the calculation is interrupted and its result is set to an empty string. It makes sense not to attempt to complete the calculation in this case, following the “garbage in, garbage out” philosophy.
Orbeon Forms has experimentally supported exposing type annotations to XPath for years, but recently we have ironed them out and enabled them by default for new forms created with Form Builder. And we are now working to officially make this part of XForms 2!
For more details, see the Orbeon Forms documentation.

  1. Besides validation, types can also, depending on the XForms engine, affect the visual representation of a form control associated with that piece of data. A classical example is a date picker for an xs:date value.  ↩
  2. Orbeon Forms on the other hand has always supported XPath 2 as an extension of XForms 1.1.  ↩

Tuesday, January 15, 2013

Orbeon Forms 4.0 Beta 2

Today we released the second Beta release of Orbeon Forms 4.0! Like 4.0 Beta and the previous milestone builds this is not a final release.

In this release, we fixed a number of Internet Explorer issues (in particular for IE 7, which we don't recommend to use but which we still support, but also some IE 8 and IE 9 issues), some improvements to the Form Runner Wizard view, and more. Here is the overall list of changes since the first Beta:
  • Form Builder
    • Also add Italian and Korean among top languages
  • Form Runner
    • Wizard: truncate long section titles to the left (#711)
    • Non-relevant sections show in wizard view (#699)
    • Blank causes invalid request (#713)
    • Call the search API without app/form returns no documents (#709)
    • IE8: licence plate digits appear vertically (#705)
    • IE7: Navigation boxes around arrows not tall enough (#723)
    • IE7: Navbar is too high(#721)
    • IE7: Wizard: too much space in TOC (#722)
    • IE7: Unbalanced padding with input fields (#727)
    • IE7: Bootstrap add-on misaligned (#728)
    • IE7: Grid cell content not top-aligned (#729)
    • IE7: fr:box-select too wide (#730)
    • IE7: Upload control too wide (#731)
    • ClassCastException when using Oracle persistence layer on JBoss 7 (#726)
  • XForms engine
    • Regression: XML parsing error with IE9 after fix to #682 (#717)
    • IE9: Checkboxes misaligned (#704)
    • xf:output with date type outputs timezone (#689)
    • Better radio/checkboxes alignment
  • Other
    • Set Xerces SecurityManager (#686)
More information is available in the in-progress release notes for 4.0.

You can download the builds using these links:
Don't forget to grab a trial license for the PE version.

Please send feedback:

Thursday, January 10, 2013

Orbeon Forms 4.0 Beta

Today we released the first Beta release of Orbeon Forms 4.0! Like 4.0 M19 and the previous milestone builds this is not a final release.
We have addressed lots of issues in this Beta release, covering Form Builder, Form Runner, Liferay support, and more. We also addressed a bunch of UI and cosmetic issues and increased the amount of testing we have done. With this, we have closed almost all the known bugs we wanted to address for 4.0.

Here is the overall list of changes since M19:
  • Form Builder
    • FB: control validation dialog is too tall and fieldset legends too big (#471)
    • Custom buttons are showing in Form Builder (#658)
    • Wizard does not show in test when testing a form from Form Builder (#624)
    • Unclear spacing for custom control properties (#383)
    • Message about XPath error when using $fr-roles in the builder (#354)
    • Fix "XXXXXXX" in model.xml (#632)
    • Better alignment in Validation Properties (#671)
    • Better labels in Edit Grid Details dialog (#672)
    • List of languages is hard to use (#685)
    • Wrong row deleted (#683)
    • Schema dialog: can't see all simple types (#692)
    • Validation dialog shows Double when Schema type is picked (#693)
    • Permissions not saved (#695)
    • FB Test fails with 403 (#702)
  • Form Runner
    • Review page: textarea uses monospace font (#631)
    • Add property for supplemental CSS (#617)
    • Schema generation fails when using eXist persistence layer (#666)
    • Section titles are 3 times taller (#669)
    • Accessible link in navbar is too tall (#656)
    • Review mode: repeat shows +/- icons again (#673)
    • Buttons touch the bottom of the viewport (#654)
    • Repeat: missing rowspan messes up table (#675)
    • User with only Create role can see forms on summary page (#696)
    • Excel import fails with 403 during validation (#701)
  • XForms engine
    • With Chrome, upload control alignment is incorrect (#623)
    • TypedNodeWrapper exception with fr:number/currency (#657)
    • Regression: Don't enable debug XForms logging by default (a83d11197e)
    • TinyMCE .htm files missing in the build (#663)
    • upon restarting Tomcat (#644)
    • Upload shows selector if there is an initial file (#674)
    • xf:upload file size is not formatted (#575)
    • Unsupported event context information for event('input-only') (#665)
    • Bookcast example is garbled (#655)
    • Data type not applied as CSS attribute to xf:input inside a xf:group (#659)
    • Exception with simple xxf:control="true" (#680)
    • On IE a space is "removed" from input fields (#682)
    • xxforms:if / xxforms:while don't work anymore (#684)
  • Liferay support
    • Check status of portlet examples (#608)
    • Some hidden controls appear (#539)
    • New form crashes in Liferay (#537)
    • Bookcast fails when saving (#538)
    • Crash when coming back from accessible mode (#668)
    • com.liferay.portal.NoSuchRoleException (#305)
    • Error downloading attachment with proxy portlet (#559)
  • Other
    • Restore XUpdate processor (#355)
    • Option to hide Orbeon Forms version in page (#676)
    • Tentative fix for deadlock in lastModifiedImpl (f054f8e02d)
    • cosmetic UI fixes
    • refactoring
More information is available in the in-progress release notes for 4.0.

You can download the builds using these links:
Don't forget to grab a trial license for the PE version.

Please send feedback:

Tuesday, January 8, 2013

Automatic remapping of Windows-1252 characters to Unicode

Nowadays, almost everything uses Unicode, which supports a large (very large!) number of characters. Unicode assign a code (number) to each character, and in most cases this code is represented with:

  • With UTF-16 when in memory (e.g. in Java and Windows since NT);
  • With UTF-8 when sent over the wire.

Before Unicode, a single byte per character was used for Western languages, with the ISO Latin-1 encoding. This encoding was fine for most Western characters but didn't contain some useful characters, such as curved quotes, the euro sign, the trademark sign, plus many others. In their infinite wisdom, Microsoft decided to use some reserved codes of Latin-1 for those "useful" characters, creating the Windows 1252 encoding.

Unicode is based on Latin-1, and not Windows-1252, which means that the code for all those "useful characters" is higher than 255 in Unicode. The problem is that documents encoded with Windows-1252 are often incorrectly opened as Latin-1. The mistake is easy to do, as it works "in most cases". The error is so common, that the HTML5 spec says that a browser should parse document advertised as using Latin-1 as Windows-1252 (not trusting the advertised encoding!).

But should you incorrectly take that Windows-1252 encoded file as a Latin-1 encoded file, and pass along its content to a system where it is saved as Unicode, you might end up with control characters; if the text is sent back to the browser, still as Unicode, those control characters will show as squares, instead of the curved quotes, euro sign, or trademark signs you originally intended.

Luckily, there is a way to safely and automatically fix incorrectly encoded documents. This is done by changing the code for characters that exist in Windows-1252, but not Latin-1, to their valid Unicode code, using a simple conversion table. And Orbeon automatically does this for you. And of course, configuration properties allow you to disable this automatic conversion, or even to setup your own custom conversion.