cbosson
cbosson

Reputation: 113

Orbeon : possible to use <xforms:repeat> in <xforms:action>?

In a modal dialog, when the user clicks ok, I have to insert different "template" instances in an existing instance. The number of template instances to insert depends of the number of elements in another nodeset. I've tried to implement this behavior that way :

<xforms:trigger>
    <xforms:label>OK</xforms:label>
    <xforms:action ev:event="DOMActivate">
        <xforms:repeat nodeset="$currentBranche/../../Eleves/Eleve">
            <xforms:insert context="instance('examen-template')/Notes" nodeset="Note" at="1" position="before" origin="instance('note-template')"/>                                
        </xforms:repeat>
        <xforms:insert context="$currentBranche/Examens" nodeset="Examen" at="1" position="before" origin="instance('examen-template')"/>
        <xxforms:hide dialog="create-examen"/>                            
    </xforms:action>
</xforms:trigger>

I got the following error : Invalid action: {http://www.w3.org/2002/xforms}repeat

Does it mean that I can't use xforms:repeat in a xforms:action ? If it's the case, how can I implement the desired behavior ?

Upvotes: 1

Views: 368

Answers (2)

ebruchez
ebruchez

Reputation: 7857

As Alain mentions, xforms:repeat is a user interface element and can't be used within actions.

Instead use the XForms 2.0 iterate attribute in implementations that support it. Builds of Orbeon Forms since this commit from March 10, 2012) support it. If you are using Orbeon Forms 3.9 or builds before March 10, 2012, use the xxforms:iterate extension.

Upvotes: 2

Alain Couthures
Alain Couthures

Reputation: 1523

Instead of xforms:repeat, you can use @iterate in XForms 2.0 (The iterate attribute) which is, at least, already implemented in Orbeon as xxforms:iterate : More powerful XForms actions thanks to iterations

-Alain

Upvotes: 2

Related Questions