Take the 2-minute tour ×

Orbeon version: Orbeon Forms

I have the following code in a Javascript file. This code is executed, but it seems like the model in the XBL is not found.

ORBEON.xforms.Document.dispatchEvent("model-name", "event-name");

Here is the model in the XBL. There are several models in the XBL. I don't see any message, so it seems as though the model isn't found. I don't see any errors in the logs.

<xforms:model id="model-name" xxforms:external-events="event-name">
  <xforms:action ev:event="event-name">

Does anyone know if there is some trick to getting a dispatch to work from Javascript to XBL?

Thanks very much!


Another thing that could be the problem (maybe?) is that calling the javascript from the XBL using instance(this) isn't working. I wonder if the instance of the class isn't tied to a component instance, therefore it can't find the model?

Here's the call to the javascript from the xbl that doesn't invoke the init method:


Here's the call that does invoke the init() method:


Here's the javascript:

YAHOO.xbl.fr.myTest = function() {};
ORBEON.xforms.XBL.declareClass(YAHOO.xbl.fr.myTest, "xbl-fr-myTest");

YAHOO.xbl.fr.myTest.prototype = {

init: function() {

valueChanged: function() {

share|improve this question
add comment

1 Answer

AFAIK you can't address the XBL-internal model directly from outside, because of its strong encapsulation.

Instead, you'll have to dispatch the event to the xbl component node. For example, if you want an instance of the fr:currency XBL to handle a certain event, you'll have to dispatch the event to that fr:currency element that's part of your XForm.

Inside the XBL, you can define xbl:handlers to act upon that event, triggering some JavaScript action or something else.

share|improve this answer
Thanks! I will give that a try! –  mstrom Oct 13 '11 at 0:58
@mstrom: Hope it works! If it does, feel free to accept the answer ;) (if it doesn't work, please report any errors) –  tohuwawohu Oct 20 '11 at 8:20
@mstrom is right; from JavaScript, you need to target a control in XBL when sending an event. Think of it this way: since you can have multiple instances of that component in your page, when you say "send event my-event to my-model", when the server gets that information, it can't know which instance of my-model you're talking about. Instead, if you send an event to a control, you'll be getting that control from the DOM, and use its id. That id will have all the information needed by the XForms engine to know which instance of the XBL component you're talking about. –  avernet Oct 24 '11 at 17:43
add comment

Your Answer


