Hi.
I have a problem with xforms-value-changed event. The example code like that:
<html>
<head>
<xforms:model>
<xforms:instance id="instance">
<form xmlns="">
<person>
<name>Mr.Li</name>
<age>23</age>
</person>
</form>
</xforms:instance>
<xforms:submission id="next" ref="instance('instance')"
method="post" replace="instance" instance="instance"
action="/get-next-person"/>
</xforms:model>
</head>
<body>
<xforms:input ref="instance('instance')/person/name">
<xforms:label>Name: </xforms:label>
</xforms:input>
<xforms:input ref="instance('instance')/person/age">
<xforms:label>Age: </xforms:label>
<xforms:action ev:event="xforms-value-changed">
<xxforms:script>
alert('xforms-value-changed of age');
</xxforms:script>
<xforms:action>
</xforms:input>
<xforms:trigger>
<xforms:label>Get Next Person</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:send submission="next"/>
<xforms:action> </xforms:trigger> </body>
</html>
The 'xforms-value-changed' event didn't fire when click 'Get Next Person' button. In fact, the value of person's age is changed.
I test these case:
1. 'replace' of submission control is 'instance', xforms-value-changed event is not fired;
2. 'replace' of submission control is 'node', xforms-value-changed event is fired;
3. 'replace' of submission control is 'text', xforms-value-changed event is fired;
My problem is that: why doesn't fire xforms-value-changed in first case? 百万玩家同玩的乐园,人气爆发的梦幻西游 -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hi,
> The 'xforms-value-changed' event didn't fire when click 'Get Next > Person' button. In fact, the value of person's age is changed. That event is "dispatched in response to: a change to an instance data node bound to a form control." I suppose it doesn't matter if the _instance_ changes; relevant is only a change regarding the node value in a certain instance. > I test these case: > 1. 'replace' of submission control is 'instance', > xforms-value-changed event is not fired; That's correct in my opinion. Neither the value of the "age" node of instance A nor that of the same node of instance B have changed. It's not a change of the value of a certain node that happened, instead it's a replacement of the complete instance; the _nodes_ of the instances haven't changed. > 2. 'replace' of submission control is 'node', xforms-value-changed > event is fired; Here the instance remains instance A, and its node "age" has changed, so the event should get fired. > 3. 'replace' of submission control is 'text', xforms-value-changed > event is fired; Same as 2. To check if the node value has changed after an instance change, there are different ways. One could use a second "observer" instance with a node bound to the "age" node of the main instance and its value calculated from that node. The node of the "observer" instance then should change in every of the three test cases, and in all the three cases a change event should get dispatched regarding the "observer" node. florian -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Florian,
The spec seems to have a hole here. It mentions there should be a refresh. However, it doesn't say that "the node must be marked for dispatching the xforms-value-changed event" as it does in other cases. But clearly, the control is bound to a node with value v1, and then upon refresh is bound to a new node with value v2, and the control is not notified that its value has changed. This is quite counter-intuitive I think. In fact, Orbeon Forms went beyond the spec and assumed that all nodes actually changed. However, this case shows that this was broken at some point! I committed a fix that should make this work again. I have also sent an email to the public XForms list at W3C to mention the problem. -Erik Florian Schmitt wrote: > Hi, > >> The 'xforms-value-changed' event didn't fire when click 'Get Next >> Person' button. In fact, the value of person's age is changed. > > That event is "dispatched in response to: a change to an instance data > node bound to a form control." I suppose it doesn't matter if the > _instance_ changes; relevant is only a change regarding the node value > in a certain instance. > > > I test these case: > >> 1. 'replace' of submission control is 'instance', >> xforms-value-changed event is not fired; > > That's correct in my opinion. Neither the value of the "age" node of > instance A nor that of the same node of instance B have changed. It's > not a change of the value of a certain node that happened, instead it's > a replacement of the complete instance; the _nodes_ of the instances > haven't changed. > >> 2. 'replace' of submission control is 'node', xforms-value-changed >> event is fired; > > Here the instance remains instance A, and its node "age" has changed, so > the event should get fired. > >> 3. 'replace' of submission control is 'text', xforms-value-changed >> event is fired; > > Same as 2. > > To check if the node value has changed after an instance change, there > are different ways. One could use a second "observer" instance with a > node bound to the "age" node of the main instance and its value > calculated from that node. The node of the "observer" instance then > should change in every of the three test cases, and in all the three > cases a change event should get dispatched regarding the "observer" node. > > > florian 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |