Orbeon form remove an iteration to activate an action

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Orbeon form remove an iteration to activate an action

Chunyu_uk

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

--
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 [hidden email].
To post to this group, send email to [hidden email].

2015-05-24_remove.png (94K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon form remove an iteration to activate an action

Alessandro  Vernet
Administrator
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

On Mon, May 25, 2015 at 1:44 AM, Chunyu Cong <[hidden email]> wrote:

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

--
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 [hidden email].
To post to this group, send email to [hidden email].

--
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 [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon form remove an iteration to activate an action

Chunyu_uk
Hi Alex,
Your solution works!
Thanks,
Chunyu

On 26 May 2015 at 06:28, Alessandro Vernet <[hidden email]> wrote:

> 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:
>
> http://www.w3.org/MarkUp/Forms/wiki/XForms_2.0#The_xforms-delete_Event
>
> I hope this helps,
>
> Alex
>
> On Mon, May 25, 2015 at 1:44 AM, Chunyu Cong <[hidden email]> wrote:
>>
>> 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
>>
>> --
>> 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 [hidden email].
>> To post to this group, send email to [hidden email].
>
>
> --
> 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
> [hidden email].
> To post to this group, send email to [hidden email].

--
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 [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Orbeon form remove an iteration to activate an action

Alessandro  Vernet
Administrator
Chunyu, excellent! And thank you for confirming,

Alex

On Tue, May 26, 2015 at 5:40 AM, Chunyu Cong <[hidden email]> wrote:
Hi Alex,
Your solution works!
Thanks,
Chunyu

On 26 May 2015 at 06:28, Alessandro Vernet <[hidden email]> wrote:
> 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:
>
> http://www.w3.org/MarkUp/Forms/wiki/XForms_2.0#The_xforms-delete_Event
>
> I hope this helps,
>
> Alex
>
> On Mon, May 25, 2015 at 1:44 AM, Chunyu Cong <[hidden email]> wrote:
>>
>> 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
>>
>> --
>> 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 [hidden email].
>> To post to this group, send email to [hidden email].
>
>
> --
> 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
> [hidden email].
> To post to this group, send email to [hidden email].

--
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 [hidden email].
To post to this group, send email to [hidden email].

--
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 [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet