Orbeon form remove an iteration to activate an action

37 views
Skip to first unread message

Chunyu Cong

unread,
May 25, 2015, 4:44:51 AM5/25/15
to orb...@googlegroups.com

Hello,

We are facing a problem when we use Orbeon form builder and runner tools. We use form builder tool to create the form.

We try to delete some other elements in the main model when we remove a section that is set as repeat=‘content’ in the form builder. Please see the attached screen shot.

We have tried the following two ways to do it. However, none of them seems work.

  • We put dispatch at the input field of the iteration section and have the action in the main model.

body:

<xh:tr>

                                    <xh:td>

                                        <xf:input id="funding-source-name-control"

                                            bind="funding-source-name-bind">

                                            <xf:label

                                                ref="$form-resources/funding-source-name/label"/>

                                            <xf:hint ref="$form-resources/funding-source-name/hint"/>

                                            <xf:alert ref="$fr-resources/detail/labels/alert"/>

                                            <xf:action ev:event="xforms-value-changed">

                                                <xf:dispatch name="delete-company"

                                                  targetid="fr-form-model"/>

                                            </xf:action>

                                        </xf:input>

                                    </xh:td>

                                </xh:tr>

model:

<xf:action ev:event="delete-company">
                <xf:delete id="delete-company"
                    xxf:iterate="//*:funding-allocation-repeated-section-iteration"
                    context="//*:funding-allocation-repeated-section-iteration"
                    nodeset="*:company-funding-1 | *:company-percentage-1 "/>
            </xf:action>


  • We just put action code in the model.

<xf:action ev:observer="funding-sources-repeated-section-template" ev:event="xforms-insert xforms-delete xxforms-value-changed">
                <xf:delete id="delete-company"
                    xxf:iterate="instance('fr-form-instance')//*:funding-allocation-repeated-section-iteration"
                    context="instance('fr-form-instance')//*:funding-allocation-repeated-section-iteration"
                    nodeset="*:company-funding-1 | *:company-percentage-1 "/>
            </xf:action>


funding-sources-repeated-section-template is one the instances that is from the model. Fr-form-instance is the main model.

<xf:instance xxf:readonly="true" id="funding-sources-repeated-section-template">
                <funding-sources-repeated-section-iteration>
                    <funding-type/>
                    <other-funding/>
                    <other-funding-type/>
                    <funding-source-name/>
                    <capital-revenue/>
                </funding-sources-repeated-section-iteration>
            </xf:instance>

 We appreciate any help.

Please let me know if you need any more information.

Many Thanks,

Chunyu

2015-05-24_remove.png

Alessandro Vernet

unread,
May 26, 2015, 1:28:54 AM5/26/15
to orb...@googlegroups.com
Hi Chunyu,

I imagine you could use the `xforms-delete` event, which is dispatched to the instance where the deletion happened. For instance, try putting this inside the <xf:model>:

<xf:message ev:event="xforms-delete" ev:observer="fr-form-instance" value="'deleted'"/>

And the `deleted-nodes` event property will tell you which nodes were deleted:


I hope this helps,

Alex

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+un...@googlegroups.com.
To post to this group, send email to orb...@googlegroups.com.

Chunyu Cong

unread,
May 26, 2015, 8:40:11 AM5/26/15
to orb...@googlegroups.com
Hi Alex,
Your solution works!
Thanks,
Chunyu
> You received this message because you are subscribed to a topic in the
> Google Groups "Orbeon Forms" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/orbeon/iZBfzTVNmXs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Alessandro Vernet

unread,
May 26, 2015, 1:36:40 PM5/26/15
to orb...@googlegroups.com
Chunyu, excellent! And thank you for confirming,

Alex
Reply all
Reply to author
Forward
0 new messages