W3C home > Mailing lists > Public > www-forms@w3.org > February 2005

RE: How to use insert and delete actions

From: David Landwehr <dlandwehr@novell.com>
Date: Tue, 8 Feb 2005 12:30:33 +0100
To: <www-forms@w3.org>
Message-Id: <20050208113032.EC097262893@pfepc.post.tele.dk>
Hi Catherine,

The contexts for both the delete and the insert actions are the current item
in the repeat. Your nodeset expression would have been correct if the delete
and insert was outside the repeat. To get the behavior you want you should
write:

 

<xforms:delete nodeset="." at="1" ev:event="DOMActivate"/> 

<xforms:insert nodeset="." at="1" position="before" ev:event="DOMActivate"/>

 

Best regards,

David

 

  _____  

From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf
Of Catherine Poinsignon
Sent: 8. februar 2005 10:46
To: www-forms@w3.org
Subject: How to use insert and delete actions

 

Hi all,

I am trying to use the insert and delete actions to insert a new record in
my instance data or delete an existing record. Do do that, I hace the
following instance :

 

            <xforms:instance id="data"
                nweb:pageflow-replace-data="always"
nweb:primary-input-data="true">
                <meetings xmlns="">
                    <meeting day="monday" starthour="10.00">
                        <title>Sample meeting</title>
                    </meeting>
                </meetings>
            </xforms:instance>

 

I display the record using a repeat :

 

        <xforms:repeat id="meetings_index" nodeset="meeting">
                <xforms:input ref="title">
                    <xforms:label>Subject</xforms:label>
                </xforms:input>
                <xforms:select1 appearance="minimal" ref="@day">
                    <xforms:label>Day</xforms:label>
                    <xforms:choices>
    <xforms:item>
        <xforms:label>Monday</xforms:label>
        <xforms:value>monday</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>Tuesday</xforms:label>
        <xforms:value>tuesday</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>Wednesday</xforms:label>
        <xforms:value>wednesday</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>Thursday</xforms:label>
        <xforms:value>thursday</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>Friday</xforms:label>
        <xforms:value>friday</xforms:value>
    </xforms:item></xforms:choices>
                </xforms:select1>
                <xforms:select1 ref="@starthour">
                    <xforms:label>Sarts hour</xforms:label>
                    <xforms:choices>
 <xforms:item>
        <xforms:label>09.00</xforms:label>
        <xforms:value>09.00</xforms:value>
    </xforms:item>
    <xforms:item>
        <xforms:label>10.00</xforms:label>
        <xforms:value>10.00</xforms:value>
    </xforms:item>
 <xforms:item>
        <xforms:label>11.00</xforms:label>
        <xforms:value>11.00</xforms:value>
    </xforms:item>
 </xforms:choices>
                </xforms:select1>
                <xforms:trigger>
                    <xforms:label>Delete</xforms:label>
                    <xforms:action ev:event="DOMActivate">
      <xforms:delete at="index('meetings_index')"
                            ev:event="activate" nodeset="meeting"/>
                    </xforms:action>
                </xforms:trigger>
            </div>
        </xforms:repeat>

 

I wanted to add a new record by this trigger :

 

            <xforms:trigger>
                <xforms:label>New meeting</xforms:label>
    <xforms:insert at="index('meetings_index')"
                    nodeset="meeting" position="after"/>
    <xforms:setvalue ref="meeting[index('meetings_index')]/title">New
Meeting</xforms:setvalue>
            </xforms:trigger>

 

But it does not work : neither the delete, neither the new !!!

Could you please help me ?

Thanks in advance...

 

Catherine

 
Received on Tuesday, 8 February 2005 11:30:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:59 GMT