Thursday, August 29, 2013

Orbeon Forms 4.3.1 PE

Today we released Orbeon Forms 4.3.1 PE. This is a bug-fix update for Orbeon Forms PE only. For more details about the 4.3 release in general, see Orbeon Forms 4.3.
This release includes the following fixes:
  • XPath error when setting database service action (#1228)
  • fr:number processes but hides decimal part (#599)
  • Forms API to only query a specific persistence layer an app/form name is provided (#1183)
  • Autosave remains disabled when authenticating via headers (#1219)
  • FR: Single non-English language shows empty labels (#1223)
  • DB2/MySQL: Drafts for other user/group show (#1224)
  • DB2: Check difference between DB2 and MySQL search.xpl (#1225)
  • Database service error setting integer request value (#1230)
You can download the latest version of Orbeon Forms from the downloads page.

Don't forget to grab a trial license for the PE version.

Please send feedback:
We hope you enjoy this release!

Wednesday, August 14, 2013

Orbeon Forms 4.3

Today we released Orbeon Forms 4.3!

This release is rich in new features:
  • Form Builder and Form Runner
    • Enhanced validation. You can set multiple validation constraints, each with its own alert message. In addition to errors, you can also create warnings and informational messages (blog post, doc).
    • Owner/group-based permissions AKA "See your own data". You can set permissions associated with the user who created the data (the owner of the data) or the group to which that user belongs. In this release, this is supported with MySQL and DB2 only (doc).
    • Italian and German translations. In addition to the English and French translation, these are full sets of translations for Form Builder and Form Runner.
  • Form Runner
    • Autosave. When enabled, drafts of your data are automatically saved so that you never lose anything. In this release, this is supported with MySQL and DB2 only (doc).
    • Unpublish/republish. If granted administrator rights, you can unpublish and republish forms directly from the Form Runner home page.
    • New DB2 persistence layer. In addition to Oracle, MySQL, and eXist, this adds support for DB2 out of the box. This is an Orbeon Forms PE feature (doc).
    • New image annotation component. This component allows you to attach and annotate an image right from a form (requires a browsers supporting the canvas element) (doc).
  • XForms
    • Multiple constraints and alerts and constraint levels. You can now place children xf:constraint elements within xf:bind, and multiple xf:alert elements within a control. The alerts can optionally bind to individual constraints or to validation levels, so you can have different error messages depending on which constraint has failed (doc).
    • Support the `accept` attribute on xf:upload. This XForms 2.0 feature allows you to suggest which type of files the user is allowed to select, such as images, audio, video, or text files. This depends on browser support but most browsers do support it.
We have more than 64 closed issues for 4.3. Here is the complete list of changes since Orbeon Forms 4.2:
  • Form Builder
    • Support multiple alerts and warnings (#794)
    • Move Edit Source button (bb5ac3c8cf)
    • Don't place unneeded help elements in form (9f14be6057)
    • Show app name in output when no choice (#1025)
    • Setting datatype from Schema with namespace fails (#1113)
    • Support AVTs in service's resource, in Form Builder dialog (#1118)
    • Combine controls details and control validation dialogs (#85)
    • FB: Simplify list of built-in data types (#1125)
    • "Old" forms with xf:bind/@nodeset instead of @ref cause error on search page (#1133)
    • Id conflict between section templates (#142)
    • Opening control settings shows image attachment as required (#1128)
    • FB: Dot in the app name causes toolbox to fail loading (#1045)
    • Required is grayed out when using Schema type (#719)
  • Form Runner
    • Summary page to show data based on owner and/or group (#1021)
    • New image annotation component based on wPaint (#1039)
    • Image attachment: use accept attribute (#1047)
    • Actions: old value kept in instance even when out of range (#1019)
    • Alerts issues in single-line repeats (#1072)
    • Updated Form Runner Spanish resources (31f2333221)
    • FR: Exceptions don't show filename/line number (#1020)
    • New fr:tabbable component (0441d5b0ce)
    • Number / currency: show "0.x" instead of ".x" for numbers between -1 and 1 (#1106)
    • fr:grid: ability to freeze n first rows (#1108)
    • Autocomplete: in static mode, list showing only on Ajax response (#1124)
    • fr:alert-dialog: Callbacks don't support static ids anymore (#1131)
    • Proxy portlet: keep order of preferences (9e901a6241)
    • fr:error-summary: HTML label is escaped (#1145)
    • Some icons height incorrect with IE7 (#1042)
    • FR: Summary page shows escaped HTML labels (#1150)
    • FR: Autosave feature (#990)
    • FR: Unpublish/republish (#1054)
  • XForms engine
    • Support the upload `accept` attribute (#831)
    • Upload: same seq number sent twice (#1009)
    • Currency field fails to format the second time the same value is entered (#1026)
    • @xxf:maxlength not working for controls which are initially not visible (#1061)
    • Support observer in XBL handler (044c7b73d9)
    • Restored cache configuration default properties (579e2b1408)
    • Make xforms.state cache a disk cache (481b6f6d28)
    • Alert tooltip: JavaScript error, alert icon not hiding after tooltip is shown (#1075)
    • Bind XPath analysis incorrect modifies expressions (#1085)
    • Use separator other then "$" in ids (#1094)
    • Model variable uses older value of preceding model variable (#1104)
    • Model variables shadow action and view variables (#698)
    • xf:model/xf:var/@model doesn't scope other model's variables (#1132)
    • Implement support for data: in xf:output mediatype="image/*" (#1065)
    • Portlet: Help message blank when user is logged in (#1206)
    • xxf:evaluate-bind-property() not working with bind defined in other models (#1103)
    • XBL with mirror instance doesn't rebind after context change (#1166)
    • When a request is blocked, Ajax retries can end up using all the available threads (#1151)
    • New XPath functions
  • Other
    • Support Oracle persistence layer on WebSphere 8 (#1060) (doc)
    • Incorrect caching of 404 and error pages (#1129)
    • Logged exceptions do not show extension parameters (#1022)
    • oxf:url-generator doesn't provide location data for binary/text (#1023)
Compatibility notes:
  • The maybe-require-valid sub-process introduced in 4.2 has been removed, as well as the property.
  • The pdf action in processes has been removed. Use the pdf-url property in submission content instead.
  • The XForms repeat and component separators have changed to help with jQuery integration. If you depend on them for testing (for example with Selenium), you might have to make some changes.
Also note that in Form Builder, the Edit Source button has been moved to the top right corner of the form:

You can download the latest version of Orbeon Forms from the downloads page.
Don't forget to grab a trial license for the PE version.

Please send feedback:
We hope you enjoy this release!

Formulas for summing values, done right

Recently, we’ve been asked a number of questions relating to computing the sum of numbers in a form, whether with Form Builder or with plain XForms.

This seems pretty simple, because XPath, the expression language used by Orbeon Forms, has a sum() function. But there can be some difficulties:

  • Values can be missing, for example because the user hasn’t yet entered them.
  • Values can be incorrect, for example if the user has entered “gaga” instead of a valid number.

This can be solved in a couple of ways:

  1. If there is any missing or incorrect value, then produce a blank result.
  2. Or, ignore the missing or incorrect values and always produce a result. Is no value is present or correct, then output 0.

First, we assume that all the values have a decimal data type. With Form Builder, you simply specify the “Decimal” data type for the control.

Then say that you have 3 fields to sum called a, b, and c.

The “Calculate” expression to write for the first approach is simply:

sum(($a, $b, $c))

The sum() function takes a sequence of nodes or values (which is why you have to double the parentheses). If the expression fails due to missing or incorrect values, then the result of the calculation is set to a blank value.

The “Calculate” expression for the second approach looks like this:

sum(($a, $b, $c)[string() castable as xs:decimal], 0.0)

We are still using the same sequence of three values, but we are filtering them with a condition (called a predicate). The predicate only allows values which are castable as (or convertible to) a decimal value, so only those values are passed to the sum() function.

The function supports a second argument which is the value to return in case no value satisfies the predicate. This makes sure that we return a decimal value, as we are using a literal decimal 0.0.[1]

In this second scenario, the calculation always succeeds, even if values are missing or incorrect.

Here is a plain XForms example.

On as similar topic, see also Better formulas with XPath type annotations.

  1. A slightly tricky bit is the use of the string() function. You would think that you could write:  ↩

    sum(($a, $b, $c)[. castable as xs:decimal], 0.0)

    And this works in general. However, accessing the context item with . attempts to retrieve the typed value, as with the XPath data() function. If the value is a decimal, then there’s no problem. But if the value is not a decimal, a runtime error will happen. Using the string() function prevents that problem by returning the string value of the data. If the data is “gaga”, then that’s returned, and used to check whether it is castable as a decimal value.

Tuesday, August 6, 2013

New image annotation control

With Form Builder, you can easily design forms that take file attachments:
  1. Add a file attachment control to your form, for instance to allow users to attach a supporting document such as a PDF or Word document.
  2. If the file users need to attach is a picture, use the image attachment control, and users will be able to see the image they uploaded in the form.
  3. And in Orbeon Forms 4.3 (soon to be released, at the time of this writing), we added an image annotation control: 

When filling out a form with an image annotation control, you start by selecting an image, and you can then write text and draw simple shapes on top of that image. The control stores the image separately from the annotations, so you can always erase part of or all of the drawing you made. We think that our customers in certain verticals, like healthcare (e.g. medical imaging) and governments (e.g. documentation for construction or remodeling permits), will find this control especially useful.

Our thanks go to Rob (@websanova), the author of the wPaint jQuery plugin, which we use for this control.