title: Can an Orbeon event in an XBL be dispatched from Javascript?
body: <p>Orbeon version:  Orbeon Forms 3.8.0.201005270113 </p>
  
  <p>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.</p>
  
  <pre><code>ORBEON.xforms.Document.dispatchEvent("model-name", "event-name");
  </code></pre>
  
  <p>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.</p>
  
  <pre><code>&lt;xforms:model id="model-name" xxforms:external-events="event-name"&gt;
    &lt;xforms:action ev:event="event-name"&gt;
      &lt;xforms:message&gt;Test&lt;/xforms:message&gt;
    &lt;/xforms:action&gt;
  &lt;/xforms:model&gt;
  </code></pre>
  
  <p>Does anyone know if there is some trick to getting a dispatch to work from Javascript to XBL?</p>
  
  <p>Thanks very much!</p>
  
  <h2>UPDATED:</h2>
  
  <p>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?</p>
  
  <p>Here's the call to the javascript from the xbl that <em>doesn't</em> invoke the init method:</p>
  
  <pre><code>&lt;xxforms:script&gt;YAHOO.xbl.fr.myTest.instance(this).init();&lt;/xxforms:script&gt;
  </code></pre>
  
  <p>Here's the call that <em>does</em> invoke the init() method:</p>
  
  <pre><code>&lt;xxforms:script&gt;YAHOO.xbl.fr.myTest.prototype.init();&lt;/xxforms:script&gt;
  </code></pre>
  
  <p>Here's the javascript:</p>
  
  <pre><code>YAHOO.namespace("xbl.fr");
  YAHOO.xbl.fr.myTest = function() {};
  ORBEON.xforms.XBL.declareClass(YAHOO.xbl.fr.myTest, "xbl-fr-myTest");
  
  YAHOO.xbl.fr.myTest.prototype = {
  },
  
  init: function() {
      alert('test');
  },
  
  valueChanged: function() {
  },
  
  };
  </code></pre>