Problem with 2 xforms:repeat on 1 page

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

Problem with 2 xforms:repeat on 1 page

Henrik Pettersen
All,

I have found a problem where there are unexpected and inconstent interactions between 2 xforms:repeat elements on the same page. I am not sure if I am doing something wrong, or if this is a known or unknown issue with OPS 3.5.

If this is an hitherto unknown issue with OPS, I would be more than happy to provide a stand-alone example test case for you.

Steps to reproduce:
-----------------------------
1. Render page
2. Click on "Edit Fact" for the first (and only) row under the heading FACTS
3. Look at the tomcat logs from OPS. Note that the correct fact instance has been submitted.
4. Click on "Edit Rule" for the first (and only) row under the heading RULES
5. Look at the tomcat logs from OPS. Note that the correct rule instance has NOT been submitted.
6. Instead, note that the actual instance submitted is the currently highlighted FACT from the previous xforms:repeat block,
    and NOT the expected rule instance
7. It seems like the submission element is sending the incorrect instance back to the server for the submission

Here is my instance:
-------------------------------
 <xforms:instance id="knowledgebase">
     <xi:include href="input:data" xxi:omit-xml-base="true"/>
 </xforms:instance>

(which comes to)

<aspic:knowledgebase xmlns:aspic="http://www.cruk.com/aspic/editor/v1"
    <aspic:id>14</aspic:id>
    <aspic:caption>carrell transport</aspic:caption>
    <aspic:description>A demo knowledge base for deciding how to transport organs.</aspic:description>
    <aspic:rule aspic:fact="true">
        <aspic:id>38</aspic:id>
        <aspic:knowledgebaseid>14</aspic:knowledgebaseid>
        <aspic:name/>
        <aspic:caption>Simple Fact</aspic:caption>
        <aspic:description/>
        <aspic:degreeOfBelief> 1.0</aspic:degreeOfBelief>
        <aspic:premise/>
        <aspic:consequent>a</aspic:consequent>
        <aspic:expression>a</aspic:expression>
    </aspic:rule>
    <aspic:rule aspic:fact="false">
        <aspic:id>42</aspic:id>
        <aspic:knowledgebaseid>14</aspic:knowledgebaseid>
        <aspic:name>r1</aspic:name>
        <aspic:caption>Simple Implication</aspic:caption>
        <aspic:description/>
        <aspic:degreeOfBelief>1.0</aspic:degreeOfBelief>
        <aspic:premise>a</aspic:premise>
        <aspic:consequent>b</aspic:consequent>
        <aspic:expression>r1: a => b</aspic:expression>
    </aspic:rule>
</aspic:knowledgebase>


Here is my 2 submission elements for 2 different xforms:repeat elements:
-----------------------------------------------------------------------------------------------------------
<xforms:submission id="edit-fact-submission"
                               ref="instance('knowledgebase')/aspic:rule[index('fact-repeat')]"
                               method="post"
                               action="/fact/edit"/>

<xforms:submission id="edit-rule-submission"
                   ref="instance('knowledgebase')/aspic:rule[index('rule-repeat')]"
                   method="post"
                   action="/rule/edit"/>

Here are my 2 xforms:repeat blocks:
----------------------------------------------------

<!-- BLOCK ONE -->
<xhtml:div id="rule-details">
    <xhtml:h2>FACTS</xhtml:h2>                              
    <xhtml:table >
        <xforms:repeat nodeset="instance('knowledgebase')/aspic:rule[@aspic:fact='true']" id="fact-repeat">
            <xhtml:tr>
                <xhtml:td>
                    <xforms:output ref="xxforms:repeat-current('fact-repeat')/aspic:expression" xxforms:format="."/>
                </xhtml:td>
                <xhtml:td>
                    <xforms:output ref="aspic:degreeOfBelief"/>
                </xhtml:td>
                <xhtml:td>
                    <xforms:output ref="xxforms:repeat-current('fact-repeat')/aspic:caption" xxforms:format="."/>
                </xhtml:td>                                  
                <xhtml:td>
                    <!-- SUBMISSION -->
                    <xforms:trigger appearance="xxforms:image">
                        <xxforms:img src="/styling/img/small/document_edit.png" title="Edit Fact" alt="Edit Fact"/>
                        <xforms:label>&#160;</xforms:label>
                        <xforms:action ev:event="DOMActivate">
                            <xforms:send submission="edit-fact-submission"/>
                        </xforms:action>
                    </xforms:trigger>
                </xhtml:td>
            </xhtml:tr>
        </xforms:repeat>
    </xhtml:table>
</xhtml:div>

<!-- BLOCK TWO -->
<xhtml:div id="rule-details">
    <xhtml:h2>RULES</xhtml:h2>                               
    <xhtml:table >
        <xforms:repeat nodeset="instance('knowledgebase')/aspic:rule[@aspic:fact='false']" id="rule-repeat">
            <xhtml:tr>
                <xhtml:td>
                    <xforms:output ref="xxforms:repeat-current('rule-repeat')/aspic:expression" xxforms:format="."/>
                </xhtml:td>
                <xhtml:td>
                    <xforms:output ref="aspic:degreeOfBelief"/>
                </xhtml:td>
                <xhtml:td>
                    <xforms:output ref="xxforms:repeat-current('rule-repeat')/aspic:caption" xxforms:format="."/>
                </xhtml:td>                                   

                <xhtml:td>
                    <!-- SUBMISSION -->
                    <xforms:trigger appearance="xxforms:image">
                        <xxforms:img src="/styling/img/small/document_edit.png" title="Edit Rule" alt="Edit Rule"/>
                        <xforms:label>&#160;</xforms:label>
                        <xforms:action ev:event="DOMActivate">
                            <xforms:send submission="edit-rule-submission"/>
                        </xforms:action>
                    </xforms:trigger>
                </xhtml:td>                                                                                                   
            </xhtml:tr>                                                                                  
        </xforms:repeat>
    </xhtml:table>                      
</xhtml:div>

Has anyone seen this before? Am I doing something incorrect here? Is this a bug or is it just me?

Thanks, everyone!

Sincerely,
Henrik Pettersen
Advanced Computation Laboratory
Cancer Research UK










--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem with 2 xforms:repeat on 1 page

Alessandro  Vernet
Administrator
Henrik,

Looking at your code:

* The submission with id "edit-fact-submission" submits
instance('knowledgebase')/aspic:rule[index('fact-repeat')]
* The submission with id "edit-rule-submission" submits
instance('knowledgebase')/aspic:rule[index('rule-repeat')]

So they both submit what looks like a rule, but take a rule at a
different index. Is this correct? And you are saying that if you hit
the second trigger that runs submission id "edit-rule-submission", it
submits the rule at the wrong index? It seems that it would be easier
to figure this out if you could create an example that we can run in
the XForms sandbox.

Alex

On 10/12/06, Henrik Pettersen <[hidden email]> wrote:

> All,
>
> I have found a problem where there are unexpected and inconstent
> interactions between 2 xforms:repeat elements on the same page. I am not
> sure if I am doing something wrong, or if this is a known or unknown issue
> with OPS 3.5.
>
> If this is an hitherto unknown issue with OPS, I would be more than happy to
> provide a stand-alone example test case for you.
>
> Steps to reproduce:
> -----------------------------
> 1. Render page
> 2. Click on "Edit Fact" for the first (and only) row under the heading FACTS
> 3. Look at the tomcat logs from OPS. Note that the correct fact instance has
> been submitted.
> 4. Click on "Edit Rule" for the first (and only) row under the heading RULES
> 5. Look at the tomcat logs from OPS. Note that the correct rule instance has
> NOT been submitted.
> 6. Instead, note that the actual instance submitted is the currently
> highlighted FACT from the previous xforms:repeat block,
>     and NOT the expected rule instance
> 7. It seems like the submission element is sending the incorrect instance
> back to the server for the submission
>
> Here is my instance:
> -------------------------------
>  <xforms:instance id="knowledgebase">
>      <xi:include href="input:data" xxi:omit-xml-base="true"/>
>  </xforms:instance>
>
> (which comes to)
>
> <aspic:knowledgebase
> xmlns:aspic="http://www.cruk.com/aspic/editor/v1"
>     <aspic:id>14</aspic:id>
>     <aspic:caption>carrell transport</aspic:caption>
>     <aspic:description>A demo knowledge base for deciding how to transport
> organs.</aspic:description>
>     <aspic:rule aspic:fact="true">
>         <aspic:id>38</aspic:id>
>          <aspic:knowledgebaseid>14</aspic:knowledgebaseid>
>         <aspic:name/>
>         <aspic:caption>Simple Fact</aspic:caption>
>         <aspic:description/>
>         <aspic:degreeOfBelief> 1.0</aspic:degreeOfBelief>
>         <aspic:premise/>
>         <aspic:consequent>a</aspic:consequent>
>         <aspic:expression>a</aspic:expression>
>     </aspic:rule>
>      <aspic:rule aspic:fact="false">
>         <aspic:id>42</aspic:id>
>         <aspic:knowledgebaseid>14</aspic:knowledgebaseid>
>         <aspic:name>r1</aspic:name>
>         <aspic:caption>Simple Implication</aspic:caption>
>         <aspic:description/>
>         <aspic:degreeOfBelief>1.0</aspic:degreeOfBelief>
>         <aspic:premise>a</aspic:premise>
>         <aspic:consequent>b</aspic:consequent>
>         <aspic:expression>r1: a => b</aspic:expression>
>     </aspic:rule>
> </aspic:knowledgebase>
>
>
> Here is my 2 submission elements for 2 different xforms:repeat elements:
> -----------------------------------------------------------------------------------------------------------
> <xforms:submission id="edit-fact-submission"
>
> ref="instance('knowledgebase')/aspic:rule[index('fact-repeat')]"
>                                method="post"
>                                action="/fact/edit"/>
>
> <xforms:submission id="edit-rule-submission"
>
> ref="instance('knowledgebase')/aspic:rule[index('rule-repeat')]"
>                    method="post"
>                    action="/rule/edit"/>
>
> Here are my 2 xforms:repeat blocks:
> ----------------------------------------------------
>
> <!-- BLOCK ONE -->
> <xhtml:div id="rule-details">
>     <xhtml:h2>FACTS</xhtml:h2>
>
>     <xhtml:table >
>         <xforms:repeat
> nodeset="instance('knowledgebase')/aspic:rule[@aspic:fact='true']"
> id="fact-repeat">
>             <xhtml:tr>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('fact-repeat')/aspic:expression"
> xxforms:format="."/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output ref="aspic:degreeOfBelief"/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('fact-repeat')/aspic:caption"
> xxforms:format="."/>
>                 </xhtml:td>
>
>                 <xhtml:td>
>                     <!-- SUBMISSION -->
>                     <xforms:trigger appearance="xxforms:image">
>                         <xxforms:img
> src="/styling/img/small/document_edit.png" title="Edit
> Fact" alt="Edit Fact"/>
>                         <xforms:label>&#160;</xforms:label>
>                         <xforms:action ev:event="DOMActivate">
>                             <xforms:send
> submission="edit-fact-submission"/>
>                         </xforms:action>
>                     </xforms:trigger>
>                 </xhtml:td>
>             </xhtml:tr>
>         </xforms:repeat>
>     </xhtml:table>
> </xhtml:div>
>
> <!-- BLOCK TWO -->
> <xhtml:div id="rule-details">
>     <xhtml:h2>RULES</xhtml:h2>
>     <xhtml:table >
>         <xforms:repeat
> nodeset="instance('knowledgebase')/aspic:rule[@aspic:fact='false']"
> id="rule-repeat">
>             <xhtml:tr>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('rule-repeat')/aspic:expression"
> xxforms:format="."/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output ref="aspic:degreeOfBelief"/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('rule-repeat')/aspic:caption"
> xxforms:format="."/>
>                 </xhtml:td>
>
>                 <xhtml:td>
>                     <!-- SUBMISSION -->
>                     <xforms:trigger appearance="xxforms:image">
>                         <xxforms:img
> src="/styling/img/small/document_edit.png" title="Edit
> Rule" alt="Edit Rule"/>
>                         <xforms:label>&#160;</xforms:label>
>                         <xforms:action ev:event="DOMActivate">
>                             <xforms:send
> submission="edit-rule-submission"/>
>                         </xforms:action>
>                     </xforms:trigger>
>                 </xhtml:td>
>
>             </xhtml:tr>
>
>         </xforms:repeat>
>     </xhtml:table>
> </xhtml:div>
>
> Has anyone seen this before? Am I doing something incorrect here? Is this a
> bug or is it just me?
>
> Thanks, everyone!
>
> Sincerely,
> Henrik Pettersen
> Advanced Computation Laboratory
> Cancer Research UK
>
>
>
>
>
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Problem with 2 xforms:repeat on 1 page

Henrik Pettersen
Alex,

aha! Thanks, Alex. Looks like the mistake was with me:

> <xforms:submission id="edit-fact-submission"
>
> ref="instance('knowledgebase')
/aspic:rule[index('fact-repeat')]"
>                                method="post"
>                                action="/fact/edit"/>
>
> <xforms:submission id="edit-rule-submission"
>
> ref="instance('knowledgebase')/aspic:rule[index('rule-repeat')]"
>                    method="post"
>                    action="/rule/edit"/>\
> <xforms:repeat nodeset= "instance('knowledgebase')/aspic:rule[@aspic:fact='true']" id="fact-repeat">


Of course the index into these 2 repeats is not reusable as the index into the global 'knowledgebase' instance in the submit, because of the aspic:rule[@aspic:fact='true'] filter.

So what can we learn from all this? Be carefull with your indexes in XForms!

Thanks for your help!

Henrik


On 10/13/06, Alessandro Vernet <[hidden email]> wrote:
Henrik,

Looking at your code:

* The submission with id "edit-fact-submission" submits
instance('knowledgebase')/aspic:rule[index('fact-repeat')]
* The submission with id "edit-rule-submission" submits
instance('knowledgebase')/aspic:rule[index('rule-repeat')]

So they both submit what looks like a rule, but take a rule at a
different index. Is this correct? And you are saying that if you hit
the second trigger that runs submission id "edit-rule-submission", it
submits the rule at the wrong index? It seems that it would be easier
to figure this out if you could create an example that we can run in
the XForms sandbox.

Alex

On 10/12/06, Henrik Pettersen <[hidden email] > wrote:

> All,
>
> I have found a problem where there are unexpected and inconstent
> interactions between 2 xforms:repeat elements on the same page. I am not
> sure if I am doing something wrong, or if this is a known or unknown issue
> with OPS 3.5.
>
> If this is an hitherto unknown issue with OPS, I would be more than happy to
> provide a stand-alone example test case for you.
>
> Steps to reproduce:
> -----------------------------
> 1. Render page
> 2. Click on "Edit Fact" for the first (and only) row under the heading FACTS
> 3. Look at the tomcat logs from OPS. Note that the correct fact instance has
> been submitted.
> 4. Click on "Edit Rule" for the first (and only) row under the heading RULES
> 5. Look at the tomcat logs from OPS. Note that the correct rule instance has
> NOT been submitted.
> 6. Instead, note that the actual instance submitted is the currently
> highlighted FACT from the previous xforms:repeat block,
>     and NOT the expected rule instance
> 7. It seems like the submission element is sending the incorrect instance
> back to the server for the submission
>
> Here is my instance:
> -------------------------------
>  <xforms:instance id="knowledgebase">
>      <xi:include href="input:data" xxi:omit-xml-base="true"/>
>  </xforms:instance>
>
> (which comes to)
>
> <aspic:knowledgebase
> xmlns:aspic="http://www.cruk.com/aspic/editor/v1"
>     <aspic:id>14</aspic:id>
>     <aspic:caption>carrell transport</aspic:caption>
>     <aspic:description>A demo knowledge base for deciding how to transport
> organs.</aspic:description>
>     <aspic:rule aspic:fact="true">
>         <aspic:id>38</aspic:id>
>          <aspic:knowledgebaseid>14</aspic:knowledgebaseid>
>         <aspic:name/>
>         <aspic:caption>Simple Fact</aspic:caption>
>         <aspic:description/>
>         <aspic:degreeOfBelief> 1.0</aspic:degreeOfBelief>
>         <aspic:premise/>
>         <aspic:consequent>a</aspic:consequent>
>         <aspic:expression>a</aspic:expression>
>     </aspic:rule>
>      <aspic:rule aspic:fact="false">
>         <aspic:id>42</aspic:id>
>         <aspic:knowledgebaseid>14</aspic:knowledgebaseid>
>         <aspic:name>r1</aspic:name>
>         <aspic:caption>Simple Implication</aspic:caption>
>         <aspic:description/>
>         <aspic:degreeOfBelief>1.0</aspic:degreeOfBelief>
>         <aspic:premise>a</aspic:premise>
>         <aspic:consequent>b</aspic:consequent>
>         <aspic:expression>r1: a => b</aspic:expression>
>     </aspic:rule>
> </aspic:knowledgebase>
>
>
> Here is my 2 submission elements for 2 different xforms:repeat elements:
> -----------------------------------------------------------------------------------------------------------
> <xforms:submission id="edit-fact-submission"
>
> ref="instance('knowledgebase')/aspic:rule[index('fact-repeat')]"
>                                method="post"
>                                action="/fact/edit"/>
>
> <xforms:submission id="edit-rule-submission"
>
> ref="instance('knowledgebase')/aspic:rule[index('rule-repeat')]"

>                    method="post"
>                    action="/rule/edit"/>
>
> Here are my 2 xforms:repeat blocks:
> ----------------------------------------------------
>
> <!-- BLOCK ONE -->
> <xhtml:div id="rule-details">
>     <xhtml:h2>FACTS</xhtml:h2>
>
>     <xhtml:table >
>         <xforms:repeat
> nodeset="instance('knowledgebase')/aspic:rule[@aspic:fact='true']"
> id="fact-repeat">
>             <xhtml:tr>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('fact-repeat')/aspic:expression"
> xxforms:format="."/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output ref="aspic:degreeOfBelief"/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('fact-repeat')/aspic:caption"

> xxforms:format="."/>
>                 </xhtml:td>
>
>                 <xhtml:td>
>                     <!-- SUBMISSION -->
>                     <xforms:trigger appearance="xxforms:image">
>                         <xxforms:img
> src="/styling/img/small/document_edit.png" title="Edit
> Fact" alt="Edit Fact"/>
>                         <xforms:label>&#160;</xforms:label>
>                         <xforms:action ev:event="DOMActivate">
>                             <xforms:send
> submission="edit-fact-submission"/>
>                         </xforms:action>
>                     </xforms:trigger>
>                 </xhtml:td>
>             </xhtml:tr>
>         </xforms:repeat>
>     </xhtml:table>
> </xhtml:div>
>
> <!-- BLOCK TWO -->
> <xhtml:div id="rule-details">
>     <xhtml:h2>RULES</xhtml:h2>
>     <xhtml:table >
>         <xforms:repeat
> nodeset="instance('knowledgebase')/aspic:rule[@aspic:fact='false']"
> id="rule-repeat">
>             <xhtml:tr>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('rule-repeat')/aspic:expression"
> xxforms:format="."/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output ref="aspic:degreeOfBelief"/>
>                 </xhtml:td>
>                 <xhtml:td>
>                     <xforms:output
> ref="xxforms:repeat-current('rule-repeat')/aspic:caption"
> xxforms:format="."/>
>                 </xhtml:td>
>
>                 <xhtml:td>
>                     <!-- SUBMISSION -->
>                     <xforms:trigger appearance="xxforms:image">
>                         <xxforms:img
> src="/styling/img/small/document_edit.png" title="Edit
> Rule" alt="Edit Rule"/>
>                         <xforms:label>&#160;</xforms:label>
>                         <xforms:action ev:event="DOMActivate">
>                             <xforms:send
> submission="edit-rule-submission"/>
>                         </xforms:action>
>                     </xforms:trigger>
>                 </xhtml:td>
>
>             </xhtml:tr>
>
>         </xforms:repeat>
>     </xhtml:table>
> </xhtml:div>
>
> Has anyone seen this before? Am I doing something incorrect here? Is this a
> bug or is it just me?
>
> Thanks, everyone!
>
> Sincerely,
> Henrik Pettersen
> Advanced Computation Laboratory
> Cancer Research UK
>
>
>
>
>
>
>
>
>

>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>


--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto: [hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws