Observing changes in a node

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

Observing changes in a node

Ethan Gruber
I am working on a form for creating and managing linked data, and I need to be able to observe changes in a particular repeatable node, which is represented by an XBL component.  I need to know if any attributes of the node are modified or if any elements are added or removed from the node.  I've having trouble finding documentation to do this, but this problem probably does have a fairly straightforward solution.  I have something like:

<xforms:repeat nodeset="eac:cpfRelation" id="relation-control">
  <!-- xbl -->
  <xeac:cpfRelation/>
</xforms:repeat>

I want to update an instance with a list of actions any time attributes or elements are inserted or removed from eac:cpfRelation.

I inserted

<xforms:action ev:event="xforms-value-changed" ev:target="relation-control">...</xforms:action> but it had no effect. 

I have also tried instructions at http://stackoverflow.com/questions/8745461/how-to-get-a-value-on-event-xxforms-value-changed but was not able to get that to work.  Any recommendations?

Thanks,
Ethan


--
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
DL
Reply | Threaded
Open this post in threaded view
|

Re: Observing changes in a node

DL
This post was updated on .
I turn to jQuery functions when I don't understand how to do it in orbeon.

Here is one thread on adding a listener ...

http://stackoverflow.com/questions/2833072/how-do-i-set-up-a-listener-in-jquery-javascript-to-monitor-a-if-a-value-in-the-t

...

here is the orbeon doc ..

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-xxforms-value-changed
Reply | Threaded
Open this post in threaded view
|

Re: Re: Observing changes in a node

Ethan Gruber
Thanks,

I'll look into it, but I want to stay within the Orbeon framework if I can.  I have thought of an alternate solution where I can compare the content of each node when the document is saved with the node as it existed when the form was loaded.  It doesn't seem obvious to me how to compare the content and structure of two XML nodes, but I thought that I might be able to serialize each node into text and compare them as strings.  However, xxforms:serialize isn't working the way that I expect. 

Here's an example:

In the model:

<xforms:instance id="temp1">
                <temp>
                    <value test="2">test</value>
                </temp>
</xforms:instance>

In the view:

<xforms:trigger>
  <xforms:label>Test</xforms:label>
  <xforms:action ev:event="DOMActivate">
    <xxforms:variable name="temp1" select="xxforms:serialize(instance('temp1'), 'text')"/>
    <xforms:message level="modal">
      <xforms:output value="$temp1"/>
    </xforms:message>
  </xforms:action>
</xforms:trigger>

I expect a text string of '<value test="2">test</value>' but $temp1 is only 'test'.

Am I missing something?

Ethan

On Tue, Jun 26, 2012 at 5:33 PM, DL <[hidden email]> wrote:
I turn to jQuery functions when I don't understand how to do it in orbeon.

Here is one thread on adding a listener ...

http://stackoverflow.com/questions/2833072/how-do-i-set-up-a-listener-in-jquery-javascript-to-monitor-a-if-a-value-in-the-t

--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Observing-changes-in-a-node-tp4655357p4655358.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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




--
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: Observing changes in a node

David Lacy
In reply to this post by Ethan Gruber

Have you looked at this? I’ve never used it myself, but it might suit your needs.

 

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-xxforms-nodeset-changed

 

David Lacy

Falvey Library Technology Services

Villanova University

library.villanova.edu

610-519-7361

 

From: Ethan Gruber [mailto:[hidden email]]
Sent: Tuesday, June 26, 2012 4:35 PM
To: [hidden email]
Subject: [ops-users] Observing changes in a node

 

I am working on a form for creating and managing linked data, and I need to be able to observe changes in a particular repeatable node, which is represented by an XBL component.  I need to know if any attributes of the node are modified or if any elements are added or removed from the node.  I've having trouble finding documentation to do this, but this problem probably does have a fairly straightforward solution.  I have something like:

<xforms:repeat nodeset="eac:cpfRelation" id="relation-control">
  <!-- xbl -->
  <xeac:cpfRelation/>
</xforms:repeat>

I want to update an instance with a list of actions any time attributes or elements are inserted or removed from eac:cpfRelation.

I inserted

<xforms:action ev:event="xforms-value-changed" ev:target="relation-control">...</xforms:action> but it had no effect. 

I have also tried instructions at http://stackoverflow.com/questions/8745461/how-to-get-a-value-on-event-xxforms-value-changed but was not able to get that to work.  Any recommendations?

Thanks,
Ethan



--
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: Observing changes in a node

Ethan Gruber
Hi David,

I have tried that.  I followed the example, and it works only for additions and removals of the repeatable node, but it doesn't alert if an attribute of that node has been changed or if the structure of the repeatable node as changed (other elements inserted into it).

Ethan

On Wed, Jun 27, 2012 at 11:47 AM, David Lacy <[hidden email]> wrote:

Have you looked at this? I’ve never used it myself, but it might suit your needs.

 

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-xxforms-nodeset-changed

 

David Lacy

Falvey Library Technology Services

Villanova University

library.villanova.edu

<a href="tel:610-519-7361" value="+16105197361" target="_blank">610-519-7361

 

From: Ethan Gruber [mailto:[hidden email]]
Sent: Tuesday, June 26, 2012 4:35 PM
To: [hidden email]
Subject: [ops-users] Observing changes in a node

 

I am working on a form for creating and managing linked data, and I need to be able to observe changes in a particular repeatable node, which is represented by an XBL component.  I need to know if any attributes of the node are modified or if any elements are added or removed from the node.  I've having trouble finding documentation to do this, but this problem probably does have a fairly straightforward solution.  I have something like:

<xforms:repeat nodeset="eac:cpfRelation" id="relation-control">
  <!-- xbl -->
  <xeac:cpfRelation/>
</xforms:repeat>

I want to update an instance with a list of actions any time attributes or elements are inserted or removed from eac:cpfRelation.

I inserted

<xforms:action ev:event="xforms-value-changed" ev:target="relation-control">...</xforms:action> but it had no effect. 

I have also tried instructions at http://stackoverflow.com/questions/8745461/how-to-get-a-value-on-event-xxforms-value-changed but was not able to get that to work.  Any recommendations?

Thanks,
Ethan



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: RE: Observing changes in a node

Erik Bruchez
Administrator
There are events dispatched to xforms:instance which contain mutation
information:

xxforms-value-changed:
http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-xxforms-value-changed

xforms-insert:
http://www.w3.org/TR/xforms11/#evt-insert

xforms-delete:
http://www.w3.org/TR/xforms11/#evt-delete

-Erik

On Wed, Jun 27, 2012 at 8:55 AM, Ethan Gruber <[hidden email]> wrote:

> Hi David,
>
> I have tried that.  I followed the example, and it works only for additions
> and removals of the repeatable node, but it doesn't alert if an attribute of
> that node has been changed or if the structure of the repeatable node as
> changed (other elements inserted into it).
>
> Ethan
>
> On Wed, Jun 27, 2012 at 11:47 AM, David Lacy <[hidden email]>
> wrote:
>>
>> Have you looked at this? I’ve never used it myself, but it might suit your
>> needs.
>>
>>
>>
>>
>> http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-xxforms-nodeset-changed
>>
>>
>>
>> David Lacy
>>
>> Falvey Library Technology Services
>>
>> Villanova University
>>
>> library.villanova.edu
>>
>> 610-519-7361
>>
>>
>>
>> From: Ethan Gruber [mailto:[hidden email]]
>> Sent: Tuesday, June 26, 2012 4:35 PM
>> To: [hidden email]
>> Subject: [ops-users] Observing changes in a node
>>
>>
>>
>> I am working on a form for creating and managing linked data, and I need
>> to be able to observe changes in a particular repeatable node, which is
>> represented by an XBL component.  I need to know if any attributes of the
>> node are modified or if any elements are added or removed from the node.
>> I've having trouble finding documentation to do this, but this problem
>> probably does have a fairly straightforward solution.  I have something
>> like:
>>
>> <xforms:repeat nodeset="eac:cpfRelation" id="relation-control">
>>   <!-- xbl -->
>>   <xeac:cpfRelation/>
>> </xforms:repeat>
>>
>> I want to update an instance with a list of actions any time attributes or
>> elements are inserted or removed from eac:cpfRelation.
>>
>> I inserted
>>
>> <xforms:action ev:event="xforms-value-changed"
>> ev:target="relation-control">...</xforms:action> but it had no effect.
>>
>> I have also tried instructions at
>> http://stackoverflow.com/questions/8745461/how-to-get-a-value-on-event-xxforms-value-changed
>> but was not able to get that to work.  Any recommendations?
>>
>> Thanks,
>> Ethan
>>
>>
>>
>> --
>> 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
>


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