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

RE: How to use insert and delete actions

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Tue, 8 Feb 2005 11:57:09 -0000
To: "'Catherine Poinsignon'" <catherine.poinsignon@lombard.lu>
Cc: <www-forms@w3.org>
Message-ID: <008101c50dd5$54694f30$0c01a8c0@W100>


In addition to the incorrect evaluation context referred to by David, your
event registration is also wrong.

On the insertion, you haven't said what event you are listening for --
you've just put two event handlers inline in the xf:trigger. Try this

    <xf:label>New meeting</xf:label>
    <xf:action ev:event="DOMActivate">
      ... Your event handlers ...

On the delete, you have correctly put an xf:action with an event name of
'DOMActivate', but then you've put a further @ev:event on the handler that's
in the xf:action:

>  <xforms:action ev:event="DOMActivate">
>   <xforms:delete at="index('meetings_index')"
>      ev:event="activate" nodeset="meeting"/>
> </xforms:action>

As described in the spec [1] the xf:delete will never be activated, since it
is listening for the event 'activate' to appear on its parent element -- and
since it is an xf:action it will never receive it (although it's also the
wrong name). Remove this attribute and you should be OK (after fixing the
evaluation context).

Having said that, some implementations *incorrectly* process a xf:delete
action that has an @ev:event on it, so without knowing what implementation
you are using I can't say whether your xf:delete is being executed or not.
If it *is* being executed (which is wrong), then the evaluation problem
remains. If the implementation you are using does execute this, then I would
still recommend that you remove the extra @ev:event, since this will prevent
the action from being executed if you run your form on other processors that
do not run the action, due to [1].



[1] http://www.w3.org/TR/xforms/slice10.html#action-action

Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf
Of Catherine Poinsignon
Sent: 08 February 2005 09: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"
                <meetings xmlns="">
                    <meeting day="monday" starthour="10.00">
                        <title>Sample meeting</title>

I display the record using a repeat :

        <xforms:repeat id="meetings_index" nodeset="meeting">
                <xforms:input ref="title">
                <xforms:select1 appearance="minimal" ref="@day">
                <xforms:select1 ref="@starthour">
                    <xforms:label>Sarts hour</xforms:label>
                    <xforms:action ev:event="DOMActivate">
      <xforms:delete at="index('meetings_index')"
                            ev:event="activate" nodeset="meeting"/>

I wanted to add a new record by this 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

But it does not work : neither the delete, neither the new !!!
Could you please help me ?
Thanks in advance...

Received on Tuesday, 8 February 2005 11:58:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:14 UTC