Trouble with triggering a repeatable element

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

Trouble with triggering a repeatable element

Ethan Gruber
Hi,

I'm new to XForms and Orbeon.  I've looked at the bookcast tutorial and it makes sense to me, so I have started a new project with a different XML schema that uses some of the facets that the bookcast tutorial uses--adding and deleting repeatable elements.  Here are a few portions of my view.xhtml that are relavent to the problem I'm having.  I can post the entire document if you think that will help.

<xforms:model>
            <xforms:instance id="guide">
                <ead xmlns="" id="">
                    <archdesc level="collection">
                        <dsc>
                            <c>
                                <did>
                                    <unittitle/>
                                </did>
                            </c>
                        </dsc>
                    </archdesc>
                </ead>
            </xforms:instance>
           
            <xforms:instance id="ctemplate">
                <c>
                    <did>
                        <unittitle/>
                    </did>
                </c>
            </xforms:instance>

.....
</xforms:model>

....

[To add a new element I copy/pasted this from bookcast and changed a few values:]

<xforms:trigger appearance="minimal">
                        <xforms:label><img src="../apps/xforms-bookcast/images/add.gif"/></xforms:label>
                        <xforms:insert ev:event="DOMActivate" context="instance('guide')" nodeset="/ead/archdesc/dsc/c" at="1" position="before" origin="instance('ctemplate')"/>
                    </xforms:trigger>

<xforms:repeat nodeset="/ead/archdesc/dsc/c" id="component-repeat">
                <tr>
                    <td>
                        <xforms:trigger appearance="minimal">
                            <xforms:delete ev:event="DOMActivate" context="instance('guide')" nodeset="/ead/archdesc/dsc/c" at="index('component-repeat')"/>
                            <xforms:label><img src="../apps/xforms-bookcast/images/remove.gif"/></xforms:label>
                        </xforms:trigger>
                        </td>
                    <!--<td/>-->
                    <td class="form-td">
                        <xforms:input ref="did/unittitle">
                            <xforms:label class="books-label">Title</xforms:label>
                            <xforms:alert>The title is required</xforms:alert>
                        </xforms:input>
                    </td>
                </tr>
            </xforms:repeat>

...

The delete element link works.  I'm also able to load from the exist db and from a XML file on disk and the <c> is repeated.  My only problem is with adding one.  Perhaps I'm not using the correct nodeset in the xforms:insert.  I've tried a few other values apart from the one I currently have listed, including "c", "//c", "descendant::c", "ead/archdesc/dsc/c", and "archdesc/dsc/c".

Thanks for the help.  I'm sure the problem is really simple.  Once I figure this out, I should be able to finish my project pretty quickly.

Ethan Gruber




--
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: Trouble with triggering a repeatable element

Erik Bruchez
Administrator
Ethan,

I don't see anything super-obviously wrong in your code sample. Maybe
try providing an example that runs in the sandbox?

-Erik

On Sun, Jul 19, 2009 at 7:05 PM, Ethan Gruber<[hidden email]> wrote:

> Hi,
>
> I'm new to XForms and Orbeon.  I've looked at the bookcast tutorial and it
> makes sense to me, so I have started a new project with a different XML
> schema that uses some of the facets that the bookcast tutorial uses--adding
> and deleting repeatable elements.  Here are a few portions of my view.xhtml
> that are relavent to the problem I'm having.  I can post the entire document
> if you think that will help.
>
> <xforms:model>
>             <xforms:instance id="guide">
>                 <ead xmlns="" id="">
>                     <archdesc level="collection">
>                         <dsc>
>                             <c>
>                                 <did>
>                                     <unittitle/>
>                                 </did>
>                             </c>
>                         </dsc>
>                     </archdesc>
>                 </ead>
>             </xforms:instance>
>
>             <xforms:instance id="ctemplate">
>                 <c>
>                     <did>
>                         <unittitle/>
>                     </did>
>                 </c>
>             </xforms:instance>
>
> .....
> </xforms:model>
>
> ....
>
> [To add a new element I copy/pasted this from bookcast and changed a few
> values:]
>
> <xforms:trigger appearance="minimal">
>                         <xforms:label><img
> src="../apps/xforms-bookcast/images/add.gif"/></xforms:label>
>                         <xforms:insert ev:event="DOMActivate"
> context="instance('guide')" nodeset="/ead/archdesc/dsc/c" at="1"
> position="before" origin="instance('ctemplate')"/>
>                     </xforms:trigger>
>
> <xforms:repeat nodeset="/ead/archdesc/dsc/c" id="component-repeat">
>                 <tr>
>                     <td>
>                         <xforms:trigger appearance="minimal">
>                             <xforms:delete ev:event="DOMActivate"
> context="instance('guide')" nodeset="/ead/archdesc/dsc/c"
> at="index('component-repeat')"/>
>                             <xforms:label><img
> src="../apps/xforms-bookcast/images/remove.gif"/></xforms:label>
>                         </xforms:trigger>
>                         </td>
>                     <!--<td/>-->
>                     <td class="form-td">
>                         <xforms:input ref="did/unittitle">
>                             <xforms:label
> class="books-label">Title</xforms:label>
>                             <xforms:alert>The title is
> required</xforms:alert>
>                         </xforms:input>
>                     </td>
>                 </tr>
>             </xforms:repeat>
>
> ...
>
> The delete element link works.  I'm also able to load from the exist db and
> from a XML file on disk and the <c> is repeated.  My only problem is with
> adding one.  Perhaps I'm not using the correct nodeset in the
> xforms:insert.  I've tried a few other values apart from the one I currently
> have listed, including "c", "//c", "descendant::c", "ead/archdesc/dsc/c",
> and "archdesc/dsc/c".
>
> Thanks for the help.  I'm sure the problem is really simple.  Once I figure
> this out, I should be able to finish my project pretty quickly.
>
> Ethan Gruber
>
>
>
>
> --
> 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
>
>


--
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