Bug with the DOMFocusIn event?

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

Bug with the DOMFocusIn event?

ihab

Hi everybody,
( sorry I am posting it again, but since I did not receive any answers before,
I assumed that my messages got lost in the way)

I have a table, and I want to execute some actions each time a user changes the
selected row . So my purpose is catching the event thrown when that happens.
But the problem is that the rows in my table contain each an xforms:output
control, and the following happens when the user select a new row :

-if the user clicks on the edge of the table ( not the xforms:output control
Area) then the event is triggered from the row and I can catch it by  placing
the following code in the xforms:repeat :
<xforms:insert ev:event="DOMFocusIn" ....

- the problem I have is when the user clicks on the xforms:output area: The
selected row changes, but the DOMFocusIn event in thrown from another source (
I am assuming the output   area) and no matter where I put the previous code,
it never gets executed.

Please find the code I am using below.
If you want to test what I am talking about, click first on the right edge of a
row, and notice that the output instance has changed, because the action got
executed
Then click on the output Control area ( middle of the row), and notice that
nothing happens .
Thanks guys for your help,
Ihab

This is the code I am using:

<?xml version="1.0" encoding="UTF-8"?>
<xhtml:html xmlns:f="http://orbeon.org/oxf/xml/formatting"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fe="http://www.intalio.com/bpms/workflow/xforms/forms/ProductSelection"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
  <xhtml:head>
 
    <xforms:model>
      <!-- Task Input -->
      <xforms:instance id="taskinput">
        <fe:input>
          <Products
xmlns="http://www.intalio.com/bpms/workflow/xforms/forms/ProductSelection">
            <Product>1</Product>
            <Product>2</Product>
          </Products>
        </fe:input>
      </xforms:instance>
     
      <!-- Task Output -->
      <xforms:instance id="taskoutput">
        <fe:output>
       
        </fe:output>
      </xforms:instance>
          <xforms:insert ev:event="xforms-ready"
context="instance('taskoutput')" nodeset="fe:Product"
origin="instance('taskinput')/fe:Products/fe:Product[index('xforms_cntrl_Product_rpt')]"/>
        </xforms:model>
  </xhtml:head>
  <xhtml:body>
  <widget:xforms-instance-inspector
xmlns:widget="http://orbeon.org/oxf/xml/widget"/>
  <xforms:insert ev:observer="xforms_cntrl_Product_rpt" ev:event="DOMFocusIn"
context="instance('taskoutput')" nodeset="fe:Product"
origin="instance('taskinput')/fe:Products/fe:Product[index('xforms_cntrl_Product_rpt')]"/>

        <xhtml:table>
          <xhtml:tr>
            <xhtml:th>Product</xhtml:th>
          </xhtml:tr>
                  <xforms:repeat id="xforms_cntrl_Product_rpt"
nodeset="instance('taskinput')/fe:Products/fe:Product[position() &lt;=
last()]">
                     <xhtml:tr>
               <xhtml:td class="xforms_cntrl_table-cell1">
                         <xforms:output ref="."/>
        </xhtml:td>
                         </xhtml:tr>
<xforms:insert ev:event="DOMFocusIn" context="instance('taskoutput')"
nodeset="fe:Product"
origin="instance('taskinput')/fe:Products/fe:Product[index('xforms_cntrl_Product_rpt')]"/>
        </xforms:repeat>
        </xhtml:table>

  </xhtml:body>
</xhtml:html>


--
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: Bug with the DOMFocusIn event?

Erik Bruchez
Administrator
I see what the problem is: when you click on xforms:output, we used to  
just dispatch DOMFocusIn. Then we figured we should allow for  
DOMActivate, but then the DOMFocusIn disappeared. I just fixed that,  
so you will get the two events in new builds.

In the meanwhile, you can listen on DOMActivate on xforms:output. If  
you have a recent build, you can just do:

   ev:event="DOMFocusIn DOMActivate"

-Erik

On Apr 28, 2008, at 9:59 AM, <[hidden email]> <[hidden email]
 > wrote:

>
> Hi everybody,
> ( sorry I am posting it again, but since I did not receive any  
> answers before,
> I assumed that my messages got lost in the way)
>
> I have a table, and I want to execute some actions each time a user  
> changes the
> selected row . So my purpose is catching the event thrown when that  
> happens.
> But the problem is that the rows in my table contain each an  
> xforms:output
> control, and the following happens when the user select a new row :
>
> -if the user clicks on the edge of the table ( not the xforms:output  
> control
> Area) then the event is triggered from the row and I can catch it  
> by  placing
> the following code in the xforms:repeat :
> <xforms:insert ev:event="DOMFocusIn" ....
>
> - the problem I have is when the user clicks on the xforms:output  
> area: The
> selected row changes, but the DOMFocusIn event in thrown from  
> another source (
> I am assuming the output   area) and no matter where I put the  
> previous code,
> it never gets executed.
>
> Please find the code I am using below.
> If you want to test what I am talking about, click first on the  
> right edge of a
> row, and notice that the output instance has changed, because the  
> action got
> executed
> Then click on the output Control area ( middle of the row), and  
> notice that
> nothing happens .
> Thanks guys for your help,
> Ihab
>
> This is the code I am using:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xhtml:html xmlns:f="http://orbeon.org/oxf/xml/formatting"
> xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:xforms="http://www.w3.org/2002/xforms"
> xmlns:xhtml="http://www.w3.org/1999/xhtml"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fe="http://www.intalio.com/bpms/workflow/xforms/forms/ProductSelection 
> "
> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
>  <xhtml:head>
>
>    <xforms:model>
>      <!-- Task Input -->
>      <xforms:instance id="taskinput">
> <fe:input>
>  <Products
> xmlns="http://www.intalio.com/bpms/workflow/xforms/forms/ProductSelection 
> ">
>    <Product>1</Product>
>    <Product>2</Product>
>  </Products>
> </fe:input>
>      </xforms:instance>
>
>      <!-- Task Output -->
>      <xforms:instance id="taskoutput">
> <fe:output>
>
> </fe:output>
>      </xforms:instance>
>  <xforms:insert ev:event="xforms-ready"
> context="instance('taskoutput')" nodeset="fe:Product"
> origin="instance('taskinput')/fe:Products/
> fe:Product[index('xforms_cntrl_Product_rpt')]"/>
> </xforms:model>
>  </xhtml:head>
>  <xhtml:body>
>  <widget:xforms-instance-inspector
> xmlns:widget="http://orbeon.org/oxf/xml/widget"/>
>  <xforms:insert ev:observer="xforms_cntrl_Product_rpt"  
> ev:event="DOMFocusIn"
> context="instance('taskoutput')" nodeset="fe:Product"
> origin="instance('taskinput')/fe:Products/
> fe:Product[index('xforms_cntrl_Product_rpt')]"/>
>
> <xhtml:table>
>  <xhtml:tr>
>    <xhtml:th>Product</xhtml:th>
>  </xhtml:tr>
>  <xforms:repeat id="xforms_cntrl_Product_rpt"
> nodeset="instance('taskinput')/fe:Products/fe:Product[position() &lt;=
> last()]">
>     <xhtml:tr>
>       <xhtml:td class="xforms_cntrl_table-cell1">
> <xforms:output ref="."/>
> </xhtml:td>
> </xhtml:tr>
> <xforms:insert ev:event="DOMFocusIn" context="instance('taskoutput')"
> nodeset="fe:Product"
> origin="instance('taskinput')/fe:Products/
> fe:Product[index('xforms_cntrl_Product_rpt')]"/>
> </xforms:repeat>
> </xhtml:table>
>
>  </xhtml:body>
> </xhtml:html>
>
> --
> 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
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Bug with the DOMFocusIn event?

ihab

That is Perfect!! A thousand thanks!!

But out of curiosity, how could I have known that it is a DOMActivate event
that was thrown. I am asking because the event I catched with firebug was
DomFocusIn !

Thanks again for your help.


--
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: Bug with the DOMFocusIn event?

Erik Bruchez
Administrator
What you see happen in the web browser is not necessarily what  
actually happens in the DOM we keep on the server. There is a layer on  
the server which sometimes translate events.

It is easy to see what actually happens by enabling XForms logging:

   http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-logging

-Erik

On Apr 28, 2008, at 4:25 PM, <[hidden email]> <[hidden email]
 > wrote:

>
> That is Perfect!! A thousand thanks!!
>
> But out of curiosity, how could I have known that it is a  
> DOMActivate event
> that was thrown. I am asking because the event I catched with  
> firebug was
> DomFocusIn !
>
> Thanks again for your help.
>
> --
> 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
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Bug with the DOMFocusIn event?

ihab
In reply to this post by Erik Bruchez

Erik,
When I tried to apply what you have suggested , I found out that my problem is
even more complicated than I thought!

I need to execute some actions, each time the user selects a row, no matter
what this row contains ( output, input, another table ,...)

Since I can clearly see that there is not one specific event that is dispached
when the selected row is changed, I am trying to find a workaround for that.

Any ideas how that would be possible ? how would I execute an action each time
the value of the index of the repeat is changed for instance ?

Thanks...again:)


--
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: Bug with the DOMFocusIn event?

Alessandro Vernet
Administrator
On Mon, Apr 28, 2008 at 5:38 PM,  <[hidden email]> wrote:
>  Since I can clearly see that there is not one specific event that is dispached
>  when the selected row is changed, I am trying to find a workaround for that.
>
>  Any ideas how that would be possible ? how would I execute an action each time
>  the value of the index of the repeat is changed for instance ?

Something like this should do it:

* Have the value of a node computed with a bind calculate="index('repeat-id')".
* Have a control bound to that node.
* Listen on xforms-value-changed on that control.

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 [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: Re: Bug with the DOMFocusIn event?

ihab

That sounds like a good idea!
But when I tried it, the bind seems to work partially : It initializes the
value of my node with the proper value ( 1 since the first row is the one
selected by default), but when I change the row the value of the node does not
change.

Below is the code I am using . Thanks!!

<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:f="http://orbeon.org/oxf/xml/formatting"
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:saxon="http://saxon.sf.net/"
            xmlns:xi="http://www.w3.org/2001/XInclude"
            xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">

    <xhtml:head>
        <xhtml:title>Test</xhtml:title>
        <xforms:model>

            <xforms:instance id="main-instance">
                <ui>
                    <item>Item 1</item>
                    <item>Item 2</item>
                    <item>Item 3</item>
                    <section-index/>
                </ui>
            </xforms:instance>
           
<xforms:bind nodeset="section-index" calculate="index('repeat-section')" />
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
<widget:xforms-instance-inspector
xmlns:widget="http://orbeon.org/oxf/xml/widget"/>
       
        <xforms:repeat nodeset="item" id="repeat-section">
            <xhtml:div>
                <xforms:output value="."/>
            </xhtml:div>
        </xforms:repeat>

    </xhtml:body>
</xhtml:html>


--
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: Re: Re: Bug with the DOMFocusIn event?

Alessandro Vernet
Administrator
Ihab,

On Wed, Apr 30, 2008 at 11:12 AM,  <[hidden email]> wrote:
>  But when I tried it, the bind seems to work partially : It initializes the
>  value of my node with the proper value ( 1 since the first row is the one
>  selected by default), but when I change the row the value of the node does not
>  change.

I see the issue. You can get around this by doing a recalculate on
DOMActivate, as in the example attached. This is something that we
will be fixing soon. For reference, the bug is:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=309389&group_id=168&atid=350207

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

alami.xhtml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Bug with the DOMFocusIn event?

ihab

yes, but if I could catch the event that the repeat throws when the index is
changed, I will not need the workaround with the bind .

As a reminder,the problem for me was the following :

I want to execute some actions when the index of the table changes, but the
event thrown when this happens depend on the content of the table :
for example : if the row contains normal text, the event thrown is DOMFocusIn
from the repeat control.

if the row contains xforms:output, the event thrown is DOMActivateIn from the
output control only (the repeat does not fire any event, eventhough the index
changes.

With that being said, I can even not do the workaround you suggested because I
do not have the list of events that can be fired.

But if you guys can fix that in a way that we are sure that the same event is
thrown whenever the index of the repeat is changed, regardless from its
content, that would be great!

What do you think alessandro?

Thanks!


--
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: Re: Re: Re: Re: Bug with the DOMFocusIn event?

Alessandro Vernet
Administrator
On Wed, Apr 30, 2008 at 7:26 PM,  <[hidden email]> wrote:

>
>  yes, but if I could catch the event that the repeat throws when the index is
>  changed, I will not need the workaround with the bind .
>
>  As a reminder,the problem for me was the following :
>
>  I want to execute some actions when the index of the table changes, but the
>  event thrown when this happens depend on the content of the table :
>  for example : if the row contains normal text, the event thrown is DOMFocusIn
>  from the repeat control.
>
>  if the row contains xforms:output, the event thrown is DOMActivateIn from the
>  output control only (the repeat does not fire any event, eventhough the index
>  changes.
Then you can do something like:

<xforms:action ev:event="DOMActivate DOMFocusIn">
    <xforms:setvalue ref="/ui/section-index" value="index('repeat-section')"/>
</xforms:action>

This will catch the DOMActivate (when users click on the
xforms:output) and the DOMFocusIn (when users click somewhere else in
the div inside your repeat). Note that having a space separated list
of events in ev:event is only supported in recent builds.

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 [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: Re: Re: Re: Re: Bug with the DOMFocusIn event?

Alessandro Vernet
Administrator
On Thu, May 1, 2008 at 12:17 PM, Alessandro Vernet <[hidden email]> wrote:
>  This will catch the DOMActivate (when users click on the
>  xforms:output) and the DOMFocusIn (when users click somewhere else in
>  the div inside your repeat). Note that having a space separated list
>  of events in ev:event is only supported in recent builds.

And here is the updated example that runs in the XForms sandbox.

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

alami.xhtml (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Re: Re: Bug with the DOMFocusIn event?

ihab
Thanks Alessandro I really do appreciate the time you are putting into this .

Unfortunatly, i don't know if the workaround you gave me covers all the
possibilities I need to cover. As I mentioned before, my rows can have anything
into them: text, outputs, inputs...any control without restrictions.
And from what I have seen before there is a good chance each control throws its
own type if event when you select.

Can you confirm that all controls throw either DOMFocusIn or DOMActivate?

BTW, would not it better if the repeat throws an event if the selected row
changes, no matter what the content of the table is?  of course I do not know
much about your architecture, and how hard that would be...but I think it is
the best approach ;)


--
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: Re: Re: Re: Re: Re: Re: Bug with the DOMFocusIn event?

Alessandro Vernet
Administrator
On Thu, May 1, 2008 at 12:33 PM,  <[hidden email]> wrote:
>  Can you confirm that all controls throw either DOMFocusIn or DOMActivate?

Yes. And actually you should be good just listening to DOMFocusIn.
When the user clicks on an <xforms:output> you'll have both a
DOMFocusIn and a DOMActivate.

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