Custom Events
ORBEON.xforms.Document.dispatchEvent("acme-model", "acme-super-event");
Hi there!
This example shows how you can send a custom event from JavaScript back to the XForms model. You should see
an alert message come up right after you have loaded this page. Here is how it works:
Upon XForms initialization, the XForms model receives the event xforms-ready. This
happens before the page is sent to the web browser.
The event handler for xforms-ready executes the extension xxforms:script
action which allows running JavaScript code on the client.
Just after the page is loaded in the browser, the xxforms:script action runs in the web
browser and executes its JavaScript content.
The JavaScript dispatches a custom XForms event to the XForms model. The event is sent from the web
browser to the XForms engine on the server. The event here is called acme-super-event
and must be explicitly allowed on the model using the xxforms:external-events property,
for security reasons.
The event reaches the XForms model on the server. An event handler for
xxforms:external-events causes a message to be displayed on the client.