How to get value from form builder as label of trigger?

179 views Asked by At

I'm working on custom control in Orbeon. In form builder, in settings there is a field called buttonName. Its value is supposed to show as a label of button visible in form runner.

I'm moving an old file that supposedly worked on old version of orbeon. I tried changing the way I refer to the value from form builder. Below I show old code, without my changes.

In form builder metadata I have declared input with ref:

<xbl:binding element="fr|custom-input" id="fr-custom-input-binding" xxbl:mode="lhha binding value">
        <!-- Orbeon Form Builder Component Metadata -->
        <metadata xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:xf="http://www.w3.org/2002/xforms">
...
<control-details>
<xf:input ref="@buttonName">
                    ...

Further on, there is a var to that binding

<xf:var name="binding" value="xxf:binding('fr-custom-input-binding')"/>

Finally, the reference in form runner:

                <xf:trigger class="xbl-fr-custom-input-trigger">
...
                    <xf:label value="$binding/@buttonName"></xf:label>
                </xf:trigger>
1

There are 1 answers

0
avernet On

You want to access an attribute on the control itself:

<fr:custom-input buttonName="Your value">

This in contract to an attribute that you could have on the element the control is bound to, which is what $binding points to. So $binding/@buttonName is not the right expression to use here. Instead, inside your , you want to have:

<xf:var name="buttonName" xbl:attr="xbl:text=buttonName"/>

Then you can refer in XPath to the value of the attribute as $buttonName.