Search code examples
custom-controlsorbeon

Why does the Orbeon custom control tutorial stop showing when I change the name?


I am wanting to create a number of custom controls in Orbeon. Having had (seemingly) random success, I decided to go back to basics and start with the Tutorial.

After reading through the tutorial, I copied the basic component XBL into a file, linked it up in properties-local.xml, restarted Tomcat, went into Form Builder and clicked on the new control and it inserted the input with the label and hint into a new grid box on the form as to be expected (yay).

(here is the part of the properties-local.xml file that includes my tool)

<property as="xs:string"  name="oxf.fb.toolbox.group.other.uri.*.*">
  oxf:/xbl/play/slider/slider.xbl
  oxf:/xbl/play/betterInput/betterInput.xbl
  oxf:/xbl/play/sample/sample.xbl
</property>

I then tried to change the element name from fr|tutorial-input to fr|tutoria-input as below (a nice easy change I thought).

<xbl:xbl
    xmlns:xh="http://www.w3.org/1999/xhtml"
    xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
    xmlns:xbl="http://www.w3.org/ns/xbl"
    xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">

    <xbl:binding
        element="fr|tutoria-input"
        id="fr-tutoria-input"
        xxbl:mode="lhha binding value">
        <xbl:template>
            <!-- Input points to the external single-node binding -->
            <xf:input ref="xxf:binding('fr-tutoria-input')"/>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

After, restarting Tomcat, going in to Form Builder and clicking on the new control again, it inserted an empty new grid box (no input, label or hint). Looking at the source of the form, it has inserted the input (see below) and the label and hint resources, just nothing shows.

empty grid box

<xh:tr>
    <xh:td>
        <tutoria-input xmlns="http://orbeon.org/oxf/xml/form-runner" id="control-19-control"
                       bind="control-19-bind">
            <xf:label ref="$form-resources/control-19/label"/>
            <xf:hint ref="$form-resources/control-19/hint"/>
            <xf:alert ref="$fr-resources/detail/labels/alert"/>
        </tutoria-input>
    </xh:td>
</xh:tr>

I can changed the tutoria-input back to tutorial-input in the source code (without changing my code back), apply and it will show up in the form, so obviously it is running off the code included with Orbeon and using the magical something I am missing. I have even gone as far as to grep through the source to find all occurrences of tutorial-input to see if there was a file I was missing.

Please, what am I missing to get my tutoria-input custom control showing up as it should in Form Builder/Orbeon?


Solution

  • In order to be automatically found at runtime, components must be placed in folders named with the name of the XBL component. So in your case if you decide to name your component tutoria-input, you must place it under:

    /xbl/orbeon/tutoria-input/tutoria-input.xbl