xforms-value-changed event

View: New views
8 Messages — Rating Filter:   Alert me  

xforms-value-changed event

by hcr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
 Hi,
   I want to do some action when a node of xforms instance value changed. How can I do it?
   I can use xforms-value-changed to do it, for example:
 
...
<xforms:instance id="data">
     <a>
</xforms:instance>
...
<xforms:input ref="instance('data')/a">
     <xforms:action ev:event="xforms-value-changed">
         <!--to do some thing-->
     </xforms:action>
</xforms:input>
....
   
   but this way have a problem: The xforms-value-changed is dispatched when input control value changed, for example:
...
<xforms:instance id="data">
     <item>
           <a>1</a>
     </item>
     <item>
           <a>2</a>
     </item>
</xforms:instance>
...
<xforms:repeat nodeset="instance('data')/item" id='nav'>
 
<xforms:input ref="instance('data')/item[index('nav')]/a">
     <xforms:action ev:event="xforms-value-changed">
         <!--to do some thing-->
     </xforms:action>
</xforms:input>
 
   when repeat control index change from 1 to 2, will change input control value, so dispatch xforms-value-changed of input control. but node value of xforms instance control is not changed.
 
   Should dispatch event when xforms instance's node value changed? 
 
  
 
 
 
 



22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多

--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: xforms-value-changed event

by Erik Bruchez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do you see this upon insert/delete? If so, that is a known issue. We  
dispatch too many xforms-value-changed.

But this shouldn't happen just by changing the repeat index with  
setindex.

-Erik

On Jul 24, 2008, at 2:01 AM, hechengrong wrote:

>
>  Hi,
>    I want to do some action when a node of xforms instance value  
> changed. How can I do it?
>    I can use xforms-value-changed to do it, for example:
>
> ...
> <xforms:instance id="data">
>      <a>
> </xforms:instance>
> ...
> <xforms:input ref="instance('data')/a">
>      <xforms:action ev:event="xforms-value-changed">
>          <!--to do some thing-->
>      </xforms:action>
> </xforms:input>
> ....
>
>    but this way have a problem: The xforms-value-changed is  
> dispatched when input control value changed, for example:
> ...
> <xforms:instance id="data">
>      <item>
>            <a>1</a>
>      </item>
>      <item>
>            <a>2</a>
>      </item>
> </xforms:instance>
> ...
> <xforms:repeat nodeset="instance('data')/item" id='nav'>
>
> <xforms:input ref="instance('data')/item[index('nav')]/a">
>      <xforms:action ev:event="xforms-value-changed">
>          <!--to do some thing-->
>      </xforms:action>
> </xforms:input>
>
>    when repeat control index change from 1 to 2, will change input  
> control value, so dispatch xforms-value-changed of input control.  
> but node value of xforms instance control is not changed.
>
>    Should dispatch event when xforms instance's node value changed?
>
>
>
>
>
>
>
>
> 22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多
> --
> You receive this message as a subscriber of the ops-users@...  
> mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@...
> For general help: mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: Re: xforms-value-changed event

by hcr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 I try excute setindex, this will dispatch xforms-value-changed. example is in detail.
 
 
 

在2008-07-25,"Erik Bruchez" <ebruchez@...> 写道:
>Do you see this upon insert/delete? If so, that is a known issue. We  
>dispatch too many xforms-value-changed.
>
>But this shouldn't happen just by changing the repeat index with  
>setindex.
>
>-Erik
>
>On Jul 24, 2008, at 2:01 AM, hechengrong wrote:
>
>>
>>  Hi,
>>    I want to do some action when a node of xforms instance value  
>> changed. How can I do it?
>>    I can use xforms-value-changed to do it, for example:
>>
>> ...
>> 
>>      
>> 
>> ...
>> 
>>      
>>          
>>      
>> 
>> ....
>>
>>    but this way have a problem: The xforms-value-changed is  
>> dispatched when input control value changed, for example:
>> ...
>> 
>>      
>>            1
>>      
>>      
>>            2
>>      
>> 
>> ...
>> 
>>
>> 
>>      
>>          
>>      
>> 
>>
>>    when repeat control index change from 1 to 2, will change input  
>> control value, so dispatch xforms-value-changed of input control.  
>> but node value of xforms instance control is not changed.
>>
>>    Should dispatch event when xforms instance's node value changed?
>>
>>
>>
>>
>>
>>
>>
>>
>> 22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多
>> --
>> You receive this message as a subscriber of the ops-users@...  
>> mailing list.
>> To unsubscribe: mailto:ops-users-unsubscribe@...
>> For general help: mailto:sympa@...?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>--
>Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>http://www.orbeon.com/
>



22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多
<?xml version="1.0" encoding="UTF-8"?>
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:widget="http://orbeon.org/oxf/xml/widget" xmlns="http://www.w3.org/1999/xhtml" xmlns:justep="http://www.justep.com/x5#" xmlns:ajx="http://www.ajaxforms.net/2006/ajx" xmlns:ns="http://www.justep.com/x5#" xsl:version="2.0">  
        <xhtml:head>
  <xforms:model>
  <xforms:instance id="data">
  <form xmlns="">
  <items>
  <item name="a" value="a"/>
  <item name="b" value="b"/>
  <item name="c" value="c"/>
  <item name="d" value="d"/>
  <item name="e" value="e"/>
  </items>
  <data/>
  <index/>
  </form>
  </xforms:instance>
 
  <xforms:instance id="template">
  <form xmlns="">
  <item name="new" value="new"/>
  </form>
  </xforms:instance>
 
    </xforms:model>  
        </xhtml:head>  
  <xhtml:body>
  <!--
                <xforms:input ref="instance('data')/data">
  <xforms:label/>
  <xforms:action ev:event="DOMActivate">
  <xxforms:script>alert('key down');</xxforms:script>
  </xforms:action>
                </xforms:input>

 
  <xhtml:div onclick="alert('click')">asdfasfd</xhtml:div>
  <xforms:input ref="instance('data')/data"/>
  <xforms:input  ref="instance('data')/index" incremental="true">
  <xforms:label>test</xforms:label>
  <xforms:action onclick="alert('ok')">
  <xxforms:script>alert('key down');</xxforms:script>
  </xforms:action>
  </xforms:input>
  <xforms:trigger>
  <xforms:label>insert</xforms:label>
  <xforms:action ev:event="DOMActivate">
  <xforms:insert context="instance('data')/items" origin="instance('template')/item"/>
  </xforms:action>
  </xforms:trigger>
  -->
 
  <xforms:input ref="instance('data')/index">
  </xforms:input>
  <xforms:trigger>
  <xforms:label>set index</xforms:label>
  <xforms:action ev:event="DOMActivate">
  <xforms:setindex repeat="repeat" index="instance('data')/index"/>
  </xforms:action>
  </xforms:trigger>
 
  <xhtml:h1/>
  <xhtml:table>
  <xforms:repeat nodeset="instance('data')/items/item" id="repeat">
  <!--
  <xforms:action ev:event="xforms-repeat-index-changed">
  <xxforms:script>alert('as');</xxforms:script>
 
  <xforms:setvalue ref="instance('data')/data" value="instance('data')/items/item[index('repeat')]/@value"></xforms:setvalue>
  <xforms:setvalue ref="instance('data')/index" value="index('repeat')"></xforms:setvalue>
 
  </xforms:action>
  -->
  <xhtml:tr>
  <xhtml:td><xforms:input ref="@name"/></xhtml:td>
  <xhtml:td><xforms:input ref="@value"/></xhtml:td>
  </xhtml:tr>
  </xforms:repeat>
  </xhtml:table>
 
  <xhtml:h1>detail</xhtml:h1>
  <xforms:group ref="instance('data')/items/item[index('repeat')]">
  <xforms:action ev:event="xforms-value-changed">
  <xxforms:script>alert('xforms value changed')</xxforms:script>
  </xforms:action>
  <xforms:input ref="@name"/>
  <xforms:input ref="@value"/>
  </xforms:group>
         
 
  </xhtml:body>
</xhtml:html>


--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: Re: Re: xforms-value-changed event

by Erik Bruchez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

The behavior is actually correct: the xforms-value-changed events are  
dispatched to the two fields whose values change when the index changes:

   <xforms:input ref="@name"/>
   <xforms:input ref="@value"/>

If you enable XForms logging, you will see the ids of the controls to  
which the events are dispatched.

-Erik

On Jul 24, 2008, at 6:03 PM, hechengrong wrote:

>  I try excute setindex, this will dispatch xforms-value-changed.  
> example is in detail.
>
>
>
>
> 在2008-07-25,"Erik Bruchez" <ebruchez@...> 写道:
> >Do you see this upon insert/delete? If so, that is a known issue. We
> >dispatch too many xforms-value-changed.
> >
> >But this shouldn't happen just by changing the repeat index with
> >setindex.
> >
> >-Erik
> >
> >On Jul 24, 2008, at 2:01 AM, hechengrong wrote:
> >
> >>
> >>  Hi,
> >>    I want to do some action when a node of xforms instance value
> >> changed. How can I do it?
> >>    I can use xforms-value-changed to do it, for example:
> >>
> >> ...
> >>
> >>
> >>
> >> ...
> >>
> >>
> >>
> >>
> >>
> >> ....
> >>
> >>    but this way have a problem: The xforms-value-changed is
> >> dispatched when input control value changed, for example:
> >> ...
> >>
> >>
> >>            1
> >>
> >>
> >>            2
> >>
> >>
> >> ...
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>    when repeat control index change from 1 to 2, will change input
> >> control value, so dispatch xforms-value-changed of input control.
> >> but node value of xforms instance control is not changed.
> >>
> >>    Should dispatch event when xforms instance's node value changed?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> 22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多
> >> --
> >> You receive this message as a subscriber of the ops-users@...
> >> mailing list.
> >> To unsubscribe: mailto:ops-users-unsubscribe@...
> >> For general help: mailto:sympa@...?subject=help
> >> OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >--
> >Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> >http://www.orbeon.com/
> >
>
>
> 22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多<main.xhtml>
> --
> You receive this message as a subscriber of the ops-users@...  
> mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@...
> For general help: mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: Re: Re: Re: xforms-value-changed event

by hcr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 Thanks Erik.
    I just want a event(xforms-instance-node-value-changed) that is dispatched when the value of node of xforms:instance is changed. for example:
<xforms:instance>
    <a/>
</xforms:instance>
 
<xforms:input ref="/a">
 
   when value of "/a" node is changed, it will dispatch xforms-instance-node-value-changed. How can I implement in OPS?
 
 

在2008-07-26,"Erik Bruchez" <ebruchez@...> 写道:
>Hi,
>
>The behavior is actually correct: the xforms-value-changed events are  
>dispatched to the two fields whose values change when the index changes:
>
>   
>   
>
>If you enable XForms logging, you will see the ids of the controls to  
>which the events are dispatched.
>
>-Erik
>
>On Jul 24, 2008, at 6:03 PM, hechengrong wrote:
>
>>  I try excute setindex, this will dispatch xforms-value-changed.  
>> example is in detail.
>>
>>
>>
>>
>> 在2008-07-25,"Erik Bruchez" 
>> --
>> You receive this message as a subscriber of the ops-users@...  
>> mailing list.
>> To unsubscribe: mailto:ops-users-unsubscribe@...
>> For general help: mailto:sympa@...?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>--
>Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>http://www.orbeon.com/
>


--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: Re: Re: Re: Re: xforms-value-changed event

by Alessandro Vernet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jul 28, 2008 at 3:05 AM, hechengrong <hechengrong1997@...> wrote:

>     I just want a event(xforms-instance-node-value-changed) that is
> dispatched when the value of node of xforms:instance is changed. for
> example:
> <xforms:instance>
>     <a/>
> </xforms:instance>
>
> <xforms:input ref="/a">
>
>    when value of "/a" node is changed, it will dispatch
> xforms-instance-node-value-changed. How can I implement in OPS?
Since the xforms-value-changed tells you if the value bound to a
control has changed, to know if the value of a node changes, you just
need to have a control bound to that node and make sure that the
control stays bound to the same node.

BTW, I don't know if your actual code really looks like what you
quoted in the first message of this thread. You have a repeat, but
then only show the item for the current index. So your repeat is
always showing just one control. For sure, there would be simpler ways
to do this :).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/

Re: Re: Re: Re: Re: xforms-value-changed event

by Erik Bruchez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In XForms you can't listen directly to changes on instance data nodes.  
You have to listen to changes on controls bound to instance data nodes  
instead.

The easiest way to do this is to place an event handler for xforms-
value-changed on the control bound to your node /a.

-Erik

On Jul 28, 2008, at 3:05 AM, hechengrong wrote:

>  Thanks Erik.
>     I just want a event(xforms-instance-node-value-changed) that is  
> dispatched when the value of node of xforms:instance is changed. for  
> example:
> <xforms:instance>
>     <a/>
> </xforms:instance>
>
> <xforms:input ref="/a">
>
>    when value of "/a" node is changed, it will dispatch xforms-
> instance-node-value-changed. How can I implement in OPS?
>
>
>
> 在2008-07-26,"Erik Bruchez" <ebruchez@...> 写道:
> >Hi,
> >
> >The behavior is actually correct: the xforms-value-changed events are
> >dispatched to the two fields whose values change when the index  
> changes:
> >
> >
> >
> >
> >If you enable XForms logging, you will see the ids of the controls to
> >which the events are dispatched.
> >
> >-Erik
> >
> >On Jul 24, 2008, at 6:03 PM, hechengrong wrote:
> >
> >>  I try excute setindex, this will dispatch xforms-value-changed.
> >> example is in detail.
> >>
> >>
> >>
> >>
> >> 在2008-07-25,"Erik Bruchez"
> >> --
> >> You receive this message as a subscriber of the ops-users@...
> >> mailing list.
> >> To unsubscribe: mailto:ops-users-unsubscribe@...
> >> For general help: mailto:sympa@...?subject=help
> >> OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >--
> >Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> >http://www.orbeon.com/
> >
>
> --
> You receive this message as a subscriber of the ops-users@...  
> mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@...
> For general help: mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: Re: Re: Re: Re: Re: xforms-value-changed event

by hcr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
   Yes, "The easiest way to do this is to place an event handler for xforms-
value-changed on the control bound to your node /a."
   The xforms-value-changed is dispatched when value of "/a" is changed. But some time xforms-value-changed also dispatch, for example:
   <xforms:repeat nodeset=".." id="repeat">
       <xforms:input ref="/a">
             <xforms:action ev:event="xforms-value-changed">
             </xforms:action>
       </xforms:input>
   </xforms:repeat>
when repeat index is changed, xforms-value-changed is dispatched.
 
 
 

在2008-07-30,"Erik Bruchez" <ebruchez@...> 写道:
>In XForms you can't listen directly to changes on instance data nodes.  
>You have to listen to changes on controls bound to instance data nodes  
>instead.
>
>The easiest way to do this is to place an event handler for xforms- 
>value-changed on the control bound to your node /a.
>
>-Erik
>
>On Jul 28, 2008, at 3:05 AM, hechengrong wrote:
>
>>  Thanks Erik.
>>     I just want a event(xforms-instance-node-value-changed) that is  
>> dispatched when the value of node of xforms:instance is changed. for  
>> example:
>> 
>>     
>> 
>>
>> 
>>
>>    when value of "/a" node is changed, it will dispatch xforms- 
>> instance-node-value-changed. How can I implement in OPS?
>>
>>
>>
>> 在2008-07-26,"Erik Bruchez" 



22元超值饭面,8.5折纯珍比萨,必胜宅急送网上点餐优惠多

--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws