0
votes

I tried to set up an Orbeon form with a tree (xf:select1 appearance="tree"). Using Orbeon Demo form builder I created a page with tree and it is working in Demo environment. The same XForms code in my local Tomcat environment (latest Orbeon CE) is not working - the tree is not rendered at all.

If I check working demo HTML, then there are some additinal JS after extension functions (after sections /*! Extension 'jquery.fancytree.wide.min.js' */, etc.) and there is minimized code line a.declareCompanion("fr|tree-select1",b); which I believe registers the component. The same form code my in local Tomcat instance does not generate this block in JS files.

In Orbeon source code is file TreeSelect1.scale which I believe is converted to JS and then included in rendered HTML JS files.

Also in tree-select1.xbl strange I comment:

NOTE: When using this component outside of Form Runner, the supporting JavaScript must be explicitly included.

after:

<xbl:script src="/xbl/orbeon/tree-select1/fancytree/jquery-ui.min.js"/>
<xbl:script src="/xbl/orbeon/tree-select1/fancytree/jquery.fancytree-all.min.js"/>

What must be done to be able to render the tree?

1
Are you saying that you're trying to use the <xf:select1 appearance="tree"> in a form you write by hand in XForms, and haven't created with Form Builder? - avernet
Yes, it was written by hand - in folder orbeon\WEB-INF\resources\apps I created new folder, inside folder I have page-flow.xml and view.xhtml with XForm code. I also searched Orbeon source and found that missing part of JS is from file orbeon-form-runner.js located in orbeon-form-runner.jar with path apps\fr\resources\scalajs. I have to include this JS file in my view.xhtml? I could not found not minimized source of orbeon-form-runner.js. I believe it is somehow created compiling scala files with sbt + sbt-uglify? - StevenR
Also additonal question - why for example autocomplete have js files in xbl folder (orbeon-form-runner.jar\xbl\orbeon\autocomplete), but tree-select1 does not have? - StevenR
If orbeon-form-runner.js is included the tree started to work. I really dont know what exactly is inside orbeon-form-runner.js but definitely there is compiled TreeSelect1.scala and maybe this part can be moved to xbl component tree-select1. Maybe orbeon devs can comment this. - StevenR

1 Answers

1
votes

The JavaScript for the component is not included by default. You can work around this with this:

<xh:script
    type="text/javascript" 
    src="/apps/fr/resources/scalajs/orbeon-form-runner.js"/>

And then, on your main XForms model, put the xxf:assets.baseline.excludes attribute like this:

<xf:model
    xxf:assets.baseline.excludes="/ops/javascript/scalajs/orbeon-xforms.js">

Regarding your other question about which JavaScript files are under xbl vs. not: some JavaScript files are written by hand, and are available as separate assets.

But code for other components like the tree is written in Scala and compiled with Scala.js. The resulting JavaScript for all such code is optimized and available in orbeon-xforms.js, orbeon-form-runner.js, and orbeon-form-builder.js depending on the environment. Only one of those 3 files must be included, hence the use of the xxf:assets.baseline.excludes property.