You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dmitry Barsukov <db...@gmail.com> on 2010/06/18 17:32:36 UTC

Re: [Trinidad] Table range screws JavaScript on all other form elements

Rectified form (surely a bug!) :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<f:view xmlns:f="http://java.sun.com/jsf/core"
        xmlns:tr="http://myfaces.apache.org/trinidad"
        xmlns:trh="http://myfaces.apache.org/trinidad/html">
    <trh:html>
        <trh:head><title>TABLE BUG TEST CASE</title></trh:head>
        <trh:body>
            <tr:form id="frm_main">
                    <tr:inputText id="it_search" onkeyup="alert('onkeyup:
event.type='+event.type);"/>
                    <tr:commandButton text="placebo"/>
                    <tr:table id="tbl_result" rows="50"
value="#{tblBugList}" var="row">
                        <tr:column > <tr:outputText value="#{row}"/>
</tr:column>
                    </tr:table>
            </tr:form>
        </trh:body>
    </trh:html>
</f:view>

tblBugList bean:

<managed-bean>
      <managed-bean-name>tblBugList</managed-bean-name>
      <managed-bean-class>java.util.ArrayList</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <list-entries>
        <value-class>java.lang.String</value-class>
        <value>LINE ONE</value>
        <value>LINE TWO</value>
        <value>LINE THREE</value>
      </list-entries>
 </managed-bean>

If <tr:table> attribute "rows" is set to "2" then "event" object passed to
JavaScript onkeyup event is screwed, i.e. it must point to event.type
"onkeyup" but it shows "hidden" instead of "onkeyup".

If "rows" attribute is set to > 3, i.e. table does not display ranges bar,
then event object is correct and it points to event.type "onkeyup". There is
a feeling that all other JS handlers/events are handled similarly.

This does sound like a bug to me. It is also quite critical to our
application.

Regards,
Dmitry

Re: [Trinidad] Table range screws JavaScript on all other form elements

Posted by Dmitry Barsukov <db...@gmail.com>.
Hi Max,

Your workaround, i.e. attaching event listener as your have described works
(probably due to different event parameter name) - thanks!
It is truly appreciated.

To answer your question, I can say that:
"event" object is unset/screwed/mangled on IE8, IE7 and Google Chrome
(5.0.375), but under FireFox (3.6.3) "event" object remains intact, i.e.
this is correct behaviour.

It would be a bit difficult for me to check lower versions of IE due to some
limitations I have.

Regards,
Dmitry

On 21 June 2010 15:09, Max Starets <ma...@oracle.com> wrote:

> Dmitry,
>
> The 'event' variable in your test case is not being passed into the
> listener method.
> It is a global variable on the window object. I was suggesting that you try
> registering event listeners
> in a different way that would ensure that the event object is being passed
> in as a parameter.
>
> Another question - can you reproduce it in other browsers besides IE? Does
> IE8 behave the same way as IE7?
>
> Regards,
> Max Starets

Re: [Trinidad] Table range screws JavaScript on all other form elements

Posted by Max Starets <ma...@oracle.com>.
Dmitry,

The 'event' variable in your test case is not being passed into the 
listener method.
It is a global variable on the window object. I was suggesting that you 
try registering event listeners
in a different way that would ensure that the event object is being 
passed in as a parameter.

Another question - can you reproduce it in other browsers besides IE? 
Does IE8 behave the same way as IE7?

Regards,
Max Starets

Dmitry Barsukov wrote:
> Max,
>
> It was a bit of a misleading bug description initially.
>
> The bug should be described as: "Event object parameter of "onkeyup"
> JavaScript handler is being mistakenly unset when <tr:table> contains more
> than 1 range". This becomes apparent in the rectified example.
>
> However "event" object parameter is correct when there is no ranges
> navigation bar on the table, i.e. there is just one table range.
>
> The JS handlers do get called, but the "event" parameter passed is wrong
> when the table displays ranges navigation bar.
> For our application this is a critical bug because we need to capture
> pressed key code from the event object.
>
> The above could be easily observed with the example jsf form I showed
> earlier.
>
> Regards,
> Dmitry
>
> On 18 June 2010 22:05, Max Starets <ma...@oracle.com> wrote:
>
>   
>> Dmitry,
>>
>> I guess you are saying that event.type  produces incorrect results if
>> the table navigation bar just happens to be on the page. This is definitely
>> strange.
>> I am not really familiar wit the navigation bar code, but I took a quick
>> look
>> to see if we are doing any event capturing there. I did not find anything.
>>
>> The 'event' javascript variable is global to the entire window. I would try
>> assigning a listener in javascript, so that you get the event passed in as
>> a parameter:
>>
>> function handleKeyUp(evt)
>> {
>>  alert (evt.type);
>> }
>>
>> document.getElementById("myClientId").onkeyup = handleKeyUp;
>>
>> Or (in IE):
>>
>> document.getElementById("myClientId").attachEvent('onkeyup', handleKeyUp);
>>
>> Regards,
>> Max
>>
>>
>>
>> Dmitry Barsukov wrote:
>>
>>     
>>> Rectified form (surely a bug!) :
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>>> <f:view xmlns:f="http://java.sun.com/jsf/core"
>>>        xmlns:tr="http://myfaces.apache.org/trinidad"
>>>        xmlns:trh="http://myfaces.apache.org/trinidad/html">
>>>    <trh:html>
>>>        <trh:head><title>TABLE BUG TEST CASE</title></trh:head>
>>>        <trh:body>
>>>            <tr:form id="frm_main">
>>>                    <tr:inputText id="it_search" onkeyup="alert('onkeyup:
>>> event.type='+event.type);"/>
>>>                    <tr:commandButton text="placebo"/>
>>>                    <tr:table id="tbl_result" rows="50"
>>> value="#{tblBugList}" var="row">
>>>                        <tr:column > <tr:outputText value="#{row}"/>
>>> </tr:column>
>>>                    </tr:table>
>>>            </tr:form>
>>>        </trh:body>
>>>    </trh:html>
>>> </f:view>
>>>
>>> tblBugList bean:
>>>
>>> <managed-bean>
>>>      <managed-bean-name>tblBugList</managed-bean-name>
>>>      <managed-bean-class>java.util.ArrayList</managed-bean-class>
>>>      <managed-bean-scope>session</managed-bean-scope>
>>>      <list-entries>
>>>        <value-class>java.lang.String</value-class>
>>>        <value>LINE ONE</value>
>>>        <value>LINE TWO</value>
>>>        <value>LINE THREE</value>
>>>      </list-entries>
>>>  </managed-bean>
>>>
>>> If <tr:table> attribute "rows" is set to "2" then "event" object passed to
>>> JavaScript onkeyup event is screwed, i.e. it must point to event.type
>>> "onkeyup" but it shows "hidden" instead of "onkeyup".
>>>
>>> If "rows" attribute is set to > 3, i.e. table does not display ranges bar,
>>> then event object is correct and it points to event.type "onkeyup". There
>>> is
>>> a feeling that all other JS handlers/events are handled similarly.
>>>
>>> This does sound like a bug to me. It is also quite critical to our
>>> application.
>>>
>>> Regards,
>>> Dmitry
>>>
>>>
>>>
>>>       
>>     
>
>
>   


Re: [Trinidad] Table range screws JavaScript on all other form elements

Posted by Dmitry Barsukov <db...@gmail.com>.
Max,

It was a bit of a misleading bug description initially.

The bug should be described as: "Event object parameter of "onkeyup"
JavaScript handler is being mistakenly unset when <tr:table> contains more
than 1 range". This becomes apparent in the rectified example.

However "event" object parameter is correct when there is no ranges
navigation bar on the table, i.e. there is just one table range.

The JS handlers do get called, but the "event" parameter passed is wrong
when the table displays ranges navigation bar.
For our application this is a critical bug because we need to capture
pressed key code from the event object.

The above could be easily observed with the example jsf form I showed
earlier.

Regards,
Dmitry

On 18 June 2010 22:05, Max Starets <ma...@oracle.com> wrote:

> Dmitry,
>
> I guess you are saying that event.type  produces incorrect results if
> the table navigation bar just happens to be on the page. This is definitely
> strange.
> I am not really familiar wit the navigation bar code, but I took a quick
> look
> to see if we are doing any event capturing there. I did not find anything.
>
> The 'event' javascript variable is global to the entire window. I would try
> assigning a listener in javascript, so that you get the event passed in as
> a parameter:
>
> function handleKeyUp(evt)
> {
>  alert (evt.type);
> }
>
> document.getElementById("myClientId").onkeyup = handleKeyUp;
>
> Or (in IE):
>
> document.getElementById("myClientId").attachEvent('onkeyup', handleKeyUp);
>
> Regards,
> Max
>
>
>
> Dmitry Barsukov wrote:
>
>> Rectified form (surely a bug!) :
>>
>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>> <f:view xmlns:f="http://java.sun.com/jsf/core"
>>        xmlns:tr="http://myfaces.apache.org/trinidad"
>>        xmlns:trh="http://myfaces.apache.org/trinidad/html">
>>    <trh:html>
>>        <trh:head><title>TABLE BUG TEST CASE</title></trh:head>
>>        <trh:body>
>>            <tr:form id="frm_main">
>>                    <tr:inputText id="it_search" onkeyup="alert('onkeyup:
>> event.type='+event.type);"/>
>>                    <tr:commandButton text="placebo"/>
>>                    <tr:table id="tbl_result" rows="50"
>> value="#{tblBugList}" var="row">
>>                        <tr:column > <tr:outputText value="#{row}"/>
>> </tr:column>
>>                    </tr:table>
>>            </tr:form>
>>        </trh:body>
>>    </trh:html>
>> </f:view>
>>
>> tblBugList bean:
>>
>> <managed-bean>
>>      <managed-bean-name>tblBugList</managed-bean-name>
>>      <managed-bean-class>java.util.ArrayList</managed-bean-class>
>>      <managed-bean-scope>session</managed-bean-scope>
>>      <list-entries>
>>        <value-class>java.lang.String</value-class>
>>        <value>LINE ONE</value>
>>        <value>LINE TWO</value>
>>        <value>LINE THREE</value>
>>      </list-entries>
>>  </managed-bean>
>>
>> If <tr:table> attribute "rows" is set to "2" then "event" object passed to
>> JavaScript onkeyup event is screwed, i.e. it must point to event.type
>> "onkeyup" but it shows "hidden" instead of "onkeyup".
>>
>> If "rows" attribute is set to > 3, i.e. table does not display ranges bar,
>> then event object is correct and it points to event.type "onkeyup". There
>> is
>> a feeling that all other JS handlers/events are handled similarly.
>>
>> This does sound like a bug to me. It is also quite critical to our
>> application.
>>
>> Regards,
>> Dmitry
>>
>>
>>
>
>


-- 
---
Sincerely yours
Dmitry Barsukov

Re: [Trinidad] Table range screws JavaScript on all other form elements

Posted by Max Starets <ma...@oracle.com>.
Dmitry,

I guess you are saying that event.type  produces incorrect results if
the table navigation bar just happens to be on the page. This is 
definitely strange.
I am not really familiar wit the navigation bar code, but I took a quick 
look
to see if we are doing any event capturing there. I did not find anything.

The 'event' javascript variable is global to the entire window. I would try
assigning a listener in javascript, so that you get the event passed in 
as a parameter:

function handleKeyUp(evt)
{
  alert (evt.type);
}

document.getElementById("myClientId").onkeyup = handleKeyUp;

Or (in IE):

document.getElementById("myClientId").attachEvent('onkeyup', handleKeyUp);

Regards,
Max


Dmitry Barsukov wrote:
> Rectified form (surely a bug!) :
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <f:view xmlns:f="http://java.sun.com/jsf/core"
>         xmlns:tr="http://myfaces.apache.org/trinidad"
>         xmlns:trh="http://myfaces.apache.org/trinidad/html">
>     <trh:html>
>         <trh:head><title>TABLE BUG TEST CASE</title></trh:head>
>         <trh:body>
>             <tr:form id="frm_main">
>                     <tr:inputText id="it_search" onkeyup="alert('onkeyup:
> event.type='+event.type);"/>
>                     <tr:commandButton text="placebo"/>
>                     <tr:table id="tbl_result" rows="50"
> value="#{tblBugList}" var="row">
>                         <tr:column > <tr:outputText value="#{row}"/>
> </tr:column>
>                     </tr:table>
>             </tr:form>
>         </trh:body>
>     </trh:html>
> </f:view>
>
> tblBugList bean:
>
> <managed-bean>
>       <managed-bean-name>tblBugList</managed-bean-name>
>       <managed-bean-class>java.util.ArrayList</managed-bean-class>
>       <managed-bean-scope>session</managed-bean-scope>
>       <list-entries>
>         <value-class>java.lang.String</value-class>
>         <value>LINE ONE</value>
>         <value>LINE TWO</value>
>         <value>LINE THREE</value>
>       </list-entries>
>  </managed-bean>
>
> If <tr:table> attribute "rows" is set to "2" then "event" object passed to
> JavaScript onkeyup event is screwed, i.e. it must point to event.type
> "onkeyup" but it shows "hidden" instead of "onkeyup".
>
> If "rows" attribute is set to > 3, i.e. table does not display ranges bar,
> then event object is correct and it points to event.type "onkeyup". There is
> a feeling that all other JS handlers/events are handled similarly.
>
> This does sound like a bug to me. It is also quite critical to our
> application.
>
> Regards,
> Dmitry
>
>