Search code examples
orbeonxforms

How to refresh binding of controls after modifying bound resources in Orbeon/XForms?


Following is the instance model for my form:

<xforms:model id="fr-form-model">

    <!-- Main instance -->
    <xforms:instance id="fr-form-instance">
        <form>
            <section-1> <age>20</age> <first-name>Tseveen</first-name>
            </section-1>
        </form>
    </xforms:instance>

    <!-- Bindings -->
    <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
        <xforms:bind id="section-1-bind" nodeset="section-1">
            <xforms:bind id="age-bind" name="age" nodeset="age" />
            <xforms:bind id="first-name-bind" nodeset="first-name"
                name="first-name" />
        </xforms:bind>
    </xforms:bind>

    <!-- All form resources -->
    <!-- Don't make readonly by default in case a service modifies the resources -->
    <xforms:instance id="fr-form-resources" xxforms:readonly="false">
        <resources> <resource xml:lang="en"> <section-1>
        <age> <label>Age</label> <hint>Years since borning</hint> <help>Substract birth date from current date</help>
        <alert>Age is required!</alert> </age> <first-name> <label>First
            name</label> <hint>Enter first name</hint> <help>a.k.a given name</help> <alert>First
        name is required!</alert> </first-name> </section-1> </resource> </resources>
    </xforms:instance>

As you can see controls are bound to resources in fr-form-resources.

I have an action like:

<xforms:setvalue
            ref="xxforms:instance('fr-form-resources')/resources/resource/section-1/age/label"
            value="'Doljin'" />

The idea is changing the label text of the control.

How can one refresh binding of controls after modifying bound resources in Orbeon/XForms so that the visual label text can be updated?


Solution

  • This should happen automatically without you having to do anything. If this isn't happening in your case, it might be because you don't modify the right node, or the control isn't bound to the right node. If you think you are changing the right node, please provide a minimal example that shows the problem.