repeat / switch interaction

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

repeat / switch interaction

Jim Logan-3
I had a form working that used a switch to toggle a button between
"delete" and "undelete" for a table row within a repeat. I then moved
the input controls for the row down into the cases to make the fields
non-editable when the button says "undelete". That part works fine, but
it broke a seemingly unrelated part of the form--the "add" button. Now
when I press the "add" button I get a cryptic message, "Object required".

On the mailing list archive I see other people having similar problems
with repeats and switches, but I see no resolution. Have I found a
limitation of Orbeon, or am I doing something wrong?

Please see the xform pasted below. (I tried uploading it to the sandbox,
but couldn't figure out how to send a link to it.)

Thanks,
-Jim


<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
    <head>
        <title>Person Form</title>
        <xforms:model>
            <xforms:instance id="person-instance">
                <person xmlns="" about="http://mds.org/people.owl#Jim">
                    <last-name>Butts</last-name>
                    <first-name>Seymour</first-name>
                    <pets>
                        <pet about="http://mds.org/pets.owl#Fido">
                            <name>Fido</name>
                            <age>1</age>
                        </pet>
                    </pets>
                </person>
            </xforms:instance>

            <xforms:instance id="pet-template">
                <pet xmlns="" action="added">
                    <name />
                    <age />
                </pet>
            </xforms:instance>

        </xforms:model>

        <style type="text/css">
            .xforms-label {
                font-weight: bold
            }
            .xforms-textarea-appearance-xxforms-autosize {
                width: 20em;
                margin-bottom: 2px
            }</style>
    </head>


    <body>
        <p>Person Information</p>
        <p>
            <xforms:input ref="instance('person-instance')/first-name">
                <xforms:label>First name:</xforms:label>
                <xforms:action ev:event="xforms-value-changed">
                    <xforms:insert context="."
origin="xxforms:attribute('action', 'edited')" />
                </xforms:action>
            </xforms:input>
        </p>
        <p>
            <xforms:input ref="instance('person-instance')/last-name">
                <xforms:label>Last name:</xforms:label>
                <xforms:action ev:event="xforms-value-changed">
                    <xforms:insert context="."
origin="xxforms:attribute('action', 'edited')" />
                </xforms:action>
            </xforms:input>
        </p>

        <p>Pets:</p>
        <table border="1" cellpadding="3">
            <thead>
                <tr>
                    <th>Pet Name</th>
                    <th>Age</th>
                </tr>
            </thead>
            <tbody>
                <xforms:repeat
nodeset="instance('person-instance')/pets/pet" id="pets-repeat">
                    <tr>
                        <xforms:switch>
                            <xforms:case id="not-deleted" selected="true">
                                <td>
                                    <xforms:input ref="name">
                                        <xforms:action
ev:event="xforms-value-changed">
                                            <xforms:insert context="."
if="not(../@action)"
                                               
origin="xxforms:attribute('action', 'edited')" />
                                        </xforms:action>

                                    </xforms:input>
                                </td>
                                <td>
                                    <xforms:input ref="age">
                                        <xforms:action
ev:event="xforms-value-changed">
                                            <xforms:insert context="."
if="not(../@action)"
                                               
origin="xxforms:attribute('action', 'edited')" />
                                        </xforms:action>

                                    </xforms:input>
                                </td>
                                <td>
                                    <xforms:trigger>
                                        <xforms:label>Delete</xforms:label>
                                        <xforms:action
ev:event="DOMActivate">
                                            <xforms:delete context="."
if="@action = 'added'" />
                                            <xforms:insert context="."
if="not(@action)"
                                               
origin="xxforms:attribute('action', 'deleted')" />
                                            <xforms:toggle case="deleted" />
                                        </xforms:action>
                                    </xforms:trigger>
                                </td>
                            </xforms:case>
                            <xforms:case id="deleted" selected="false">
                                <td>
                                    <xforms:output ref="name" />
                                </td>
                                <td>
                                    <xforms:output ref="age" />
                                </td>
                                <td>
                                    <xforms:trigger>
                                       
<xforms:label>Undelete</xforms:label>
                                        <!--  This may be wrong -->
                                        <xforms:action
ev:event="DOMActivate">
                                            <xforms:delete
ev:event="DOMActivate" nodeset="@action" />
                                            <xforms:toggle
case="not-deleted" />
                                        </xforms:action>
                                    </xforms:trigger>
                                   
                                </td>
                            </xforms:case>
                        </xforms:switch>
                    </tr>
                </xforms:repeat>

                <xforms:group ref="instance('pet-template')">
                    <tr>
                        <td>
                            <xforms:input ref="name" />
                        </td>
                        <td>
                            <xforms:input ref="age" />
                        </td>
                        <td>
                            <xforms:trigger>
                                <xforms:label>Add</xforms:label>
                                <xforms:action ev:event="DOMActivate">
                                    <xforms:insert
context="instance('person-instance')"
                                        nodeset="/person/pets/pet"
at="1" position="before"
                                        origin="instance('pet-template')" />
                                    <xforms:setvalue ref="name" />
                                    <xforms:setvalue ref="age" />
                                </xforms:action>
                            </xforms:trigger>
                        </td>
                    </tr>
                </xforms:group>

            </tbody>
        </table>

        <widget:xforms-instance-inspector
xmlns:widget="http://orbeon.org/oxf/xml/widget" />
    </body>
</html>





--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: repeat / switch interaction

Jim Logan-3
Jim Logan wrote:
> I had a form working that used a switch to toggle a button between
> "delete" and "undelete" for a table row within a repeat. I then moved
> the input controls for the row down into the cases to make the fields
> non-editable when the button says "undelete". That part works fine,
> but it broke a seemingly unrelated part of the form--the "add" button.
> Now when I press the "add" button I get a cryptic message, "Object
> required".
One more data point: when I add a new row and get the error, dismiss the
error, then change the instance inspector to the template instance and
then back to the person instance, the instance looks correct, but the
table is missing a row.

Am I using "repeat" and "switch" in a way I'm not supposed to, or have I
uncovered a bug?

Thanks,
-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: repeat / switch interaction

Erik Bruchez
Administrator
>> Jim,

>> I had a form working that used a switch to toggle a button between  
>> "delete" and "undelete" for a table row within a repeat. I then  
>> moved the input controls for the row down into the cases to make  
>> the fields non-editable when the button says "undelete". That part  
>> works fine, but it broke a seemingly unrelated part of the form--
>> the "add" button. Now when I press the "add" button I get a cryptic  
>> message, "Object required".
> One more data point: when I add a new row and get the error, dismiss  
> the error, then change the instance inspector to the template  
> instance and then back to the person instance, the instance looks  
> correct, but the table is missing a row.
>
> Am I using "repeat" and "switch" in a way I'm not supposed to, or  
> have I uncovered a bug?
Yes, but it seems to be fixed in nightly builds already: I repro your  
problem online, but not with the latest code.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: repeat / switch interaction

Jim Logan-3
Erik Bruchez wrote:
>
> Yes, but it seems to be fixed in nightly builds already: I repro your
> problem online, but not with the latest code.
Erik,

I installed the latest nightly just now, and it's still broken...

Thanks,
-Jim


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: repeat / switch interaction

Erik Bruchez
Administrator
My sure you force-reload the page (ctrl/cmd-shift-f5 or ctrl/cmd-shift-
reload depending on browser), or empty your browser cache first. Does  
the problem still persist?

-Erik

On May 19, 2008, at 2:43 PM, Jim Logan wrote:

> Erik Bruchez wrote:
>>
>> Yes, but it seems to be fixed in nightly builds already: I repro  
>> your problem online, but not with the latest code.
> Erik,
>
> I installed the latest nightly just now, and it's still broken...
>
> Thanks,
> -Jim
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: repeat / switch interaction

Jim Logan-3
Erik Bruchez wrote:
> My sure you force-reload the page (ctrl/cmd-shift-f5 or
> ctrl/cmd-shift-reload depending on browser), or empty your browser
> cache first. Does the problem still persist?
It's still happening in IE. I tried it in Firefox 3.0b5 and it works okay.

-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: repeat / switch interaction

Jim Logan-3
Jim Logan wrote:
> Erik Bruchez wrote:
>> My sure you force-reload the page (ctrl/cmd-shift-f5 or
>> ctrl/cmd-shift-reload depending on browser), or empty your browser
>> cache first. Does the problem still persist?
> It's still happening in IE. I tried it in Firefox 3.0b5 and it works
> okay.
>
Well, sort of okay. I can't figure out why the added row always has the
"undelete" button, which is not the default case. Any ideas?

Thanks,
-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: [Possible Spam] Re: Re: Re: Re: Re: Re: repeat / switch interaction

Jim Logan-3
Jim Logan wrote:

> Jim Logan wrote:
>> Erik Bruchez wrote:
>>> My sure you force-reload the page (ctrl/cmd-shift-f5 or
>>> ctrl/cmd-shift-reload depending on browser), or empty your browser
>>> cache first. Does the problem still persist?
>> It's still happening in IE. I tried it in Firefox 3.0b5 and it works
>> okay.
>>
> Well, sort of okay. I can't figure out why the added row always has
> the "undelete" button, which is not the default case. Any ideas?
I've been probing into this a bit further in FF 3.0b5. When I add a few
rows and then mark a row for deletion, the first row in the repeat flips
to the wrong switch case. Is this a bug or something I'm doing wrong?

Thanks,
-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: [Possible Spam] Re: Re: Re: Re: Re: Re: repeat / switch interaction

Jim Logan-3
Jim Logan wrote:
Jim Logan wrote:
Jim Logan wrote:
Erik Bruchez wrote:
My sure you force-reload the page (ctrl/cmd-shift-f5 or ctrl/cmd-shift-reload depending on browser), or empty your browser cache first. Does the problem still persist?
It's still happening in IE. I tried it in Firefox 3.0b5 and it works okay.

Well, sort of okay. I can't figure out why the added row always has the "undelete" button, which is not the default case. Any ideas?
I've been probing into this a bit further in FF 3.0b5. When I add a few rows and then mark a row for deletion, the first row in the repeat flips to the wrong switch case. Is this a bug or something I'm doing wrong?
Oops, I misspoke. I meant to say, "When I add a few rows and then delete a row, the first row in the repeat flips to the wrong switch case." It's as if pressing the delete button toggles the first row after the deletion happens. Marking the "Fido" row for deletion works correctly.

-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: [Possible Spam] Re: Re: Re: Re: Re: Re: repeat / switch interaction

Jim Logan-3
Jim Logan wrote:
Jim Logan wrote:
Jim Logan wrote:
Jim Logan wrote:
Erik Bruchez wrote:
My sure you force-reload the page (ctrl/cmd-shift-f5 or ctrl/cmd-shift-reload depending on browser), or empty your browser cache first. Does the problem still persist?
It's still happening in IE. I tried it in Firefox 3.0b5 and it works okay.

Well, sort of okay. I can't figure out why the added row always has the "undelete" button, which is not the default case. Any ideas?
I've been probing into this a bit further in FF 3.0b5. When I add a few rows and then mark a row for deletion, the first row in the repeat flips to the wrong switch case. Is this a bug or something I'm doing wrong?
Oops, I misspoke. I meant to say, "When I add a few rows and then delete a row, the first row in the repeat flips to the wrong switch case." It's as if pressing the delete button toggles the first row after the deletion happens. Marking the "Fido" row for deletion works correctly.
I found a way to make it work, but I still suspect this might be an Orbeon bug.

The work-around was to put an "if" in the toggle, as follows.
<xforms:toggle case="deleted" if="@action = 'deleted'"/>
This makes it toggle only for rows that already existed and should not get deleted within XForms (i.e., not the ones where "@action = 'added'--those can really get deleted).

-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: [Possible Spam] Re: Re: Re: Re: Re: Re: repeat / switch interaction

Jim Logan-3
Jim Logan wrote:
Jim Logan wrote:
Jim Logan wrote:
Jim Logan wrote:
Jim Logan wrote:
Erik Bruchez wrote:
My sure you force-reload the page (ctrl/cmd-shift-f5 or ctrl/cmd-shift-reload depending on browser), or empty your browser cache first. Does the problem still persist?
It's still happening in IE. I tried it in Firefox 3.0b5 and it works okay.

Well, sort of okay. I can't figure out why the added row always has the "undelete" button, which is not the default case. Any ideas?
I've been probing into this a bit further in FF 3.0b5. When I add a few rows and then mark a row for deletion, the first row in the repeat flips to the wrong switch case. Is this a bug or something I'm doing wrong?
Oops, I misspoke. I meant to say, "When I add a few rows and then delete a row, the first row in the repeat flips to the wrong switch case." It's as if pressing the delete button toggles the first row after the deletion happens. Marking the "Fido" row for deletion works correctly.
I found a way to make it work, but I still suspect this might be an Orbeon bug.

The work-around was to put an "if" in the toggle, as follows.
<xforms:toggle case="deleted" if="@action = 'deleted'"/>
This makes it toggle only for rows that already existed and should not get deleted within XForms (i.e., not the ones where "@action = 'added'--those can really get deleted).
I think I found yet another bug in Orbeon. When I delete a row, the "xforms-value-changed" event fires on the fields I haven't changed, which causes them to have the "@action='edited'" attribute. :-/

-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: repeat / switch interaction

Jim Logan-3
Jim Logan wrote:
I think I found yet another bug in Orbeon. When I delete a row, the "xforms-value-changed" event fires on the fields I haven't changed, which causes them to have the "@action='edited'" attribute. :-/
I never heard anything about whether I'm doing something wrong or Orbeon has a bug.

In the following XForm, If I add a pet, let's say "Lucy", and then delete it, the "xforms-value-changed" event fires on the "Fido" row, which flags his name and age as having been changed.

Could someone please confirm whether or not this is a bug? Is there a way I can fix it?

Thanks,
-Jim

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
    <head>
        <title>Person Form</title>
        <xforms:model>
            <xforms:instance id="person-instance">
                <person xmlns="" about="http://mds.org/people.owl#Jim">
                    <last-name>Butts</last-name>
                    <first-name>Seymour</first-name>
                    <pets>
                        <pet about="http://mds.org/pets.owl#Fido">
                            <name>Fido</name>
                            <age>1</age>
                        </pet>
                    </pets>
                </person>
            </xforms:instance>

            <!-- Template that gets edited and added -->
            <xforms:instance id="pet-template">
                <pet xmlns="" action="added">
                    <name />
                    <age />
                </pet>
            </xforms:instance>

        </xforms:model>

        <style type="text/css">
            .xforms-label {
                font-weight: bold
            }
            .xforms-textarea-appearance-xxforms-autosize {
                width: 20em;
                margin-bottom: 2px
            }</style>
    </head>


    <body>
        <p>Person Information</p>
        <p>
            <xforms:input ref="instance('person-instance')/first-name">
                <xforms:label>First name:</xforms:label>
                <xforms:action ev:event="xforms-value-changed">
                    <xforms:insert context="." origin="xxforms:attribute('action', 'edited')" />
                </xforms:action>
            </xforms:input>
        </p>
        <p>
            <xforms:input ref="instance('person-instance')/last-name">
                <xforms:label>Last name:</xforms:label>
                <xforms:action ev:event="xforms-value-changed">
                    <xforms:insert context="." origin="xxforms:attribute('action', 'edited')" />
                </xforms:action>
            </xforms:input>
        </p>

        <p>Pets:</p>
        <table border="1" cellpadding="3">
            <thead>
                <tr>
                    <th>Pet Name</th>
                    <th>Age</th>
                </tr>
            </thead>
            <tbody>
                <xforms:repeat nodeset="instance('person-instance')/pets/pet" id="pets-repeat">
                    <tr>
                       
                        <!--
                            Toggle between an editable row with a "delete" button and a read-only row with
                            an "undelete" button for pre-existing rows.
                        -->
                        <xforms:switch>

                            <xforms:case id="not-deleted" selected="true">
                                <td>
                                    <xforms:input ref="name">
                                        <xforms:action ev:event="xforms-value-changed">
                                            <xforms:insert context="." if="not(../@action)"
                                                origin="xxforms:attribute('action', 'edited')" />
                                        </xforms:action>
                                    </xforms:input>
                                </td>
                                <td>
                                    <xforms:input ref="age">
                                        <xforms:action ev:event="xforms-value-changed">
                                            <xforms:insert context="." if="not(../@action)"
                                                origin="xxforms:attribute('action', 'edited')" />
                                        </xforms:action>
                                    </xforms:input>
                                </td>
                                <td>
                                    <xforms:trigger>
                                        <xforms:label>Delete</xforms:label>
                                        <xforms:action ev:event="DOMActivate">
                                            <xforms:delete context="." if="@action = 'added'" />
                                            <xforms:insert context="." if="not(@action)"
                                                origin="xxforms:attribute('action', 'deleted')" />

                                            <!--
                                                Hacking around an Orbeon bug here: the following "if" keeps other rows from
                                                toggling by only toggling pre-existing rows.
                                            -->
                                            <xforms:toggle case="deleted" if="@action = 'deleted'"
                                             />
                                        </xforms:action>
                                    </xforms:trigger>
                                </td>
                            </xforms:case>

                            <xforms:case id="deleted" selected="false">
                                <td>
                                    <xforms:output ref="name" />
                                </td>
                                <td>
                                    <xforms:output ref="age" />
                                </td>
                                <td>
                                    <xforms:trigger>
                                        <xforms:label>Undelete</xforms:label>
                                        <!--  This may be wrong -->
                                        <xforms:action ev:event="DOMActivate">
                                            <xforms:delete ev:event="DOMActivate" nodeset="@action" />
                                            <xforms:toggle case="not-deleted" />
                                        </xforms:action>
                                    </xforms:trigger>
                                </td>
                            </xforms:case>

                        </xforms:switch>
                    </tr>
                </xforms:repeat>


                <!-- Edit the template, add it as a new row, then clear it. -->

                <xforms:group ref="instance('pet-template')">
                    <tr>
                        <td>
                            <xforms:input ref="name" />
                        </td>
                        <td>
                            <xforms:input ref="age" />
                        </td>
                        <td>
                            <xforms:trigger>
                                <xforms:label>Add</xforms:label>
                                <xforms:action ev:event="DOMActivate">
                                    <xforms:insert context="instance('person-instance')"
                                        nodeset="/person/pets/pet" at="1" position="before"
                                        origin="instance('pet-template')" />
                                    <xforms:setvalue ref="name" />
                                    <xforms:setvalue ref="age" />
                                </xforms:action>
                            </xforms:trigger>
                        </td>
                    </tr>
                </xforms:group>

            </tbody>
        </table>

        <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" />
    </body>
</html>



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: repeat / switch interaction

Erik Bruchez
Administrator
Jim,

It kind of is a bug. At the moment, the XForms engine doesn't really  
know, when you deleted a repeat iteration, that this causes subsequent  
repeat iterations to "slide down". The UI part of the XForms engine  
only sees that on the first row, instead of having "Lucy", you now  
have "Fido", so fires a value change event.

There is certainly a way to fix it, and we would like to fix this in  
the future, but it is fairly involved.

-Erik

On May 21, 2008, at 12:34 PM, Jim Logan wrote:

> Jim Logan wrote:
>>
>> I think I found yet another bug in Orbeon. When I delete a row, the  
>> "xforms-value-changed" event fires on the fields I haven't changed,  
>> which causes them to have the "@action='edited'" attribute. :-/
> I never heard anything about whether I'm doing something wrong or  
> Orbeon has a bug.
>
> In the following XForm, If I add a pet, let's say "Lucy", and then  
> delete it, the "xforms-value-changed" event fires on the "Fido" row,  
> which flags his name and age as having been changed.
>
> Could someone please confirm whether or not this is a bug? Is there  
> a way I can fix it?
>
> Thanks,
> -Jim
>
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms 
> "
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ev="http://www.w3.org/2001/xml-events 
> "
>     xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
>     <head>
>         <title>Person Form</title>
>         <xforms:model>
>             <xforms:instance id="person-instance">
>                 <person xmlns="" about="http://mds.org/ 
> people.owl#Jim">
>                     <last-name>Butts</last-name>
>                     <first-name>Seymour</first-name>
>                     <pets>
>                         <pet about="http://mds.org/pets.owl#Fido">
>                             <name>Fido</name>
>                             <age>1</age>
>                         </pet>
>                     </pets>
>                 </person>
>             </xforms:instance>
>
>             <!-- Template that gets edited and added -->
>             <xforms:instance id="pet-template">
>                 <pet xmlns="" action="added">
>                     <name />
>                     <age />
>                 </pet>
>             </xforms:instance>
>
>         </xforms:model>
>
>         <style type="text/css">
>             .xforms-label {
>                 font-weight: bold
>             }
>             .xforms-textarea-appearance-xxforms-autosize {
>                 width: 20em;
>                 margin-bottom: 2px
>             }</style>
>     </head>
>
>
>     <body>
>         <p>Person Information</p>
>         <p>
>             <xforms:input ref="instance('person-instance')/first-
> name">
>                 <xforms:label>First name:</xforms:label>
>                 <xforms:action ev:event="xforms-value-changed">
>                     <xforms:insert context="."  
> origin="xxforms:attribute('action', 'edited')" />
>                 </xforms:action>
>             </xforms:input>
>         </p>
>         <p>
>             <xforms:input ref="instance('person-instance')/last-name">
>                 <xforms:label>Last name:</xforms:label>
>                 <xforms:action ev:event="xforms-value-changed">
>                     <xforms:insert context="."  
> origin="xxforms:attribute('action', 'edited')" />
>                 </xforms:action>
>             </xforms:input>
>         </p>
>
>         <p>Pets:</p>
>         <table border="1" cellpadding="3">
>             <thead>
>                 <tr>
>                     <th>Pet Name</th>
>                     <th>Age</th>
>                 </tr>
>             </thead>
>             <tbody>
>                 <xforms:repeat nodeset="instance('person-instance')/
> pets/pet" id="pets-repeat">
>                     <tr>
>
>                         <!--
>                             Toggle between an editable row with a  
> "delete" button and a read-only row with
>                             an "undelete" button for pre-existing  
> rows.
>                         -->
>                         <xforms:switch>
>
>                             <xforms:case id="not-deleted"  
> selected="true">
>                                 <td>
>                                     <xforms:input ref="name">
>                                         <xforms:action  
> ev:event="xforms-value-changed">
>                                             <xforms:insert  
> context="." if="not(../@action)"
>                                                  
> origin="xxforms:attribute('action', 'edited')" />
>                                         </xforms:action>
>                                     </xforms:input>
>                                 </td>
>                                 <td>
>                                     <xforms:input ref="age">
>                                         <xforms:action  
> ev:event="xforms-value-changed">
>                                             <xforms:insert  
> context="." if="not(../@action)"
>                                                  
> origin="xxforms:attribute('action', 'edited')" />
>                                         </xforms:action>
>                                     </xforms:input>
>                                 </td>
>                                 <td>
>                                     <xforms:trigger>
>                                         <xforms:label>Delete</
> xforms:label>
>                                         <xforms:action  
> ev:event="DOMActivate">
>                                             <xforms:delete  
> context="." if="@action = 'added'" />
>                                             <xforms:insert  
> context="." if="not(@action)"
>                                                  
> origin="xxforms:attribute('action', 'deleted')" />
>
>                                             <!--
>                                                 Hacking around an  
> Orbeon bug here: the following "if" keeps other rows from
>                                                 toggling by only  
> toggling pre-existing rows.
>                                             -->
>                                             <xforms:toggle  
> case="deleted" if="@action = 'deleted'"
>                                              />
>                                         </xforms:action>
>                                     </xforms:trigger>
>                                 </td>
>                             </xforms:case>
>
>                             <xforms:case id="deleted"  
> selected="false">
>                                 <td>
>                                     <xforms:output ref="name" />
>                                 </td>
>                                 <td>
>                                     <xforms:output ref="age" />
>                                 </td>
>                                 <td>
>                                     <xforms:trigger>
>                                         <xforms:label>Undelete</
> xforms:label>
>                                         <!--  This may be wrong -->
>                                         <xforms:action  
> ev:event="DOMActivate">
>                                             <xforms:delete  
> ev:event="DOMActivate" nodeset="@action" />
>                                             <xforms:toggle case="not-
> deleted" />
>                                         </xforms:action>
>                                     </xforms:trigger>
>                                 </td>
>                             </xforms:case>
>
>                         </xforms:switch>
>                     </tr>
>                 </xforms:repeat>
>
>
>                 <!-- Edit the template, add it as a new row, then  
> clear it. -->
>
>                 <xforms:group ref="instance('pet-template')">
>                     <tr>
>                         <td>
>                             <xforms:input ref="name" />
>                         </td>
>                         <td>
>                             <xforms:input ref="age" />
>                         </td>
>                         <td>
>                             <xforms:trigger>
>                                 <xforms:label>Add</xforms:label>
>                                 <xforms:action ev:event="DOMActivate">
>                                     <xforms:insert  
> context="instance('person-instance')"
>                                         nodeset="/person/pets/pet"  
> at="1" position="before"
>                                         origin="instance('pet-
> template')" />
>                                     <xforms:setvalue ref="name" />
>                                     <xforms:setvalue ref="age" />
>                                 </xforms:action>
>                             </xforms:trigger>
>                         </td>
>                     </tr>
>                 </xforms:group>
>
>             </tbody>
>         </table>
>
>         <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget 
> " />
>     </body>
> </html>
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: repeat / switch interaction

Jim Logan-3
Erik Bruchez wrote:

> Jim,
>
> It kind of is a bug. At the moment, the XForms engine doesn't really
> know, when you deleted a repeat iteration, that this causes subsequent
> repeat iterations to "slide down". The UI part of the XForms engine
> only sees that on the first row, instead of having "Lucy", you now
> have "Fido", so fires a value change event.
>
> There is certainly a way to fix it, and we would like to fix this in
> the future, but it is fairly involved.
>
> -Erik
Erik,

Is there something I can do to work around this in the meantime?

If we paid for a support contract, what are the odds this could get
fixed soon? I think this bug would make it difficult to use Orbeon for
our existing instance-document-editing implementation and we would have
to do something special on the server side to compensate.

Thanks,
-Jim



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws