Client-side error handling
Disabling the standard error dialog
By default, when an Ajax error happens, Orbeon Forms shows users an error dialog.

You can disable this behavior by adding this property to your properties-local.xml
:
JavaScript event handler
Orbeon Forms exposes a custom JavaScript event: ORBEON.xforms.Events.errorEvent
.
By default a dialog is shown to the user when an error is intercepted. If you prefer to show your own dialog or to implement some other behavior in case of error, most likely you will want to:
Disable the default error dialog by setting the
oxf.xforms.show-error-dialog
property tofalse
.Register your own listener on
ORBEON.xforms.Events.errorEvent
.
You can register your own listener on that event, and when fired, send users to a page you choose, as done in the following snippet, which sends users to the Orbeon home page:
Example
In case the user session expires, or some other error happens, you would like to redirect them a page you created that will, for instance, tell users to log in and try again, and if the problem persists to contact customer support.
Providing your own dialog
File location
By default, the source markup for this dialog is available under:
This file is located inside the following jar file:
[SINCE Orbeon Forms 2016.3]
WEB-INF/lib/orbeon-core.jar
[UP TO Orbeon Forms 2016.2]
WEB-INF/lib/orbeon-resources-private.jar
You can override it in two ways:
Globally, by placing your own
error-dialog.xml
file underWEB-INF/resources/config
.Per application, by placing your own
error-dialog.xml
file underWEB-INF/resources/apps/$app
, where$app
stands for the name of your application.
Localization
[SINCE Orbeon Forms 2020.1] Should you need to provide multiple versions of the error dialog in different languages, you can do so by having multiple <div class="xforms-error-panel">
each with its own lang
attribute (see below for the full structure of the HTML you need to provide). Orbeon Forms will try to get the error panel with the lang
attribute matching the current language, and if it can't find one it will pick the first error panel.
Example: default dialog
The default dialog provides classes allowing for opening/closing a details section:
Example: minimal dialog
At a minimum, the file should contain the following structure:
CSS configuration
Advanced developers can configure the appearance of the error dialog. In most cases overriding CSS definitions should be enough.
Last updated