A lot can happen when you interact with an XForms page: events are dispatched, actions executed, submissions sent, and more. While you can have some visibility on those by enabling XForms logging in Orbeon Forms, an important part of the state of an XForms page is simply contained in the various XForms instances that you define in your page.
The XForms Inspector allows you to:
See the "live" content of your instances as you interact with the form.
Type in XPath expression, and see what the result is when they are evaluated.
See what is logged by your form to the XForms inspector console (experimental).
You can enable the XForms Inspector in one of two ways:
For all your pages, by setting the following property to
<property as="xs:boolean" name="oxf.epilogue.xforms.inspector" value="true"/>
For a specific page, by adding the following code in your XForms:
<fr:xforms-inspector/>. If you don't have the "fr" prefix in scope, instead of declaring that prefix globally, you can declare it locally:
The console is an experimental new feature, and is likely to be improved and changed in the future. When you select View Console , the output area of the inspector shows what your XForms code logs to the console. You log something to the console by dispatching an event
fr-log to the id of the XForms inspector. If you included the inspector by setting the
oxf.epilogue.xforms.inspector property to
true, that id is
orbeon-xforms-inspector. Otherwise, it is the id you put on the
<fr:xforms-inspector>. The event take one parameter:
fr-messages. Its value is a sequence of values, either elements or atomic values (strings, numbers…).
<xf:dispatch name="fr-log" target="orbeon-xforms-inspector"><xxf:contextname="fr-messages"select="instance('fr-xforms-inspector-input')"/></xf:dispatch>
In some cases, you'd like to evaluate an XPath expression you type in the console, but you want that XPath expression to be evaluated in a very particular context, for instance in a middle of a sequence of actions. For this, add the following instance to your form:
When the XForms inspector finds this instance, it shows an additional input field, and binds it to your
fr-xforms-inspector-input instance. You can then use fr-log evaluating the expression you typed in the newly added input field with: