2 Replies Latest reply on Mar 27, 2008 2:03 AM by henry katz

    listShuttle javascript error on IE (6 and 7)

    Denis Cossutta Newbie

      Hello, I have an issue trying ti use the listshuttle component in my web applicaiton. My web application based on: apache myfaces, facelets. I imported the richfaces libraries (version 3.1.4GA) to use some components like rich:datatable and rich:listshuttle. I developed a page (xhtml page) where I'm using the listshuttle component, which is put inside a h:form, and I use a h:commandlink to post the data to the server. WIth firefox everything works fine, but on IE 6 and 7 I had bad surprises. When th page is loaded I'm able to use the component without problems but when i click on the commandlink to post the data I have a javascript error:
      Error: 'null' is null or not an object
      I tried to investigate on the error debugging the javascript and I discovered that the error is generated in the prototype.js javascript (org\ajax4jsf\javascript\scripts\prototype.js) and exactly in the following line:
      prototype.jsf, line 4339

      if (window.RichFaces && window.RichFaces.Memory) {
       window.RichFaces.Memory.addCleaner("prototype", function(node) {
       var eventID = node._eventID;
       if (eventID) {
       var cache = Event.cache[eventID];
      
       for (var eventName in cache) {
       var wrappers = cache[eventName];
       var domEventName = Event.getDOMEventName(eventName);
      
       wrappers.each(function(wrapper) {
       if (node.removeEventListener) {
       node.removeEventListener(domEventName, wrapper, false);
       } else {
       node.detachEvent("on" + domEventName, wrapper);
       }
       });
      
       cache[eventName] = null;
       }
      
       delete Event.cache[eventID];
       }
       });
      }
      

      I noticed that when it does:
      var wrappers = cache[eventName];
      

      the wrappers variable is null, and therefore it generates the error when it tries to do:
      wrappers.each(function(wrapper) {...}
      

      I tried also to understand why on firefox it doesn't generate the problem and it seems like (but I'm not sure) that this code is not even reached!
      Does someone have any idea regarding this problem?

        • 1. Re: listShuttle javascript error on IE (6 and 7)
          Denis Cossutta Newbie

          I understood which is the reason of the issue I have. Using facelets, the page I was describing (the one using the listshuttle component) is a component which is inserted in another page, the main page. In the main page I load the prototype library (prototype.js) and I noticed that also the listshuttle loads the prototype library by itself. Even if the 2 prototype libraries have the same version (1.6), the one used by the richfaces component has some added lines of code and the 2 libraries are somehow in conflict at generate the error at runtime (only on IE).
          My question is: what should I do? Do I have to load only the prototype library of the listshuttle component or there is a way to make coexist the 2 libraries (Notice that I need the prototype library also in other pages)?

          • 2. Re: listShuttle javascript error on IE (6 and 7)
            henry katz Newbie

            Denis,
            I had a similar issue which unfortunately had a different resolution:

            http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137111#4137111

            I too have miserable results on IE6 (less on IE7) and am quite surprised that more people haven't as well. Have you absolutely verified with Firebug debugger that your are loading two prototypes
            into rendered page?

            Thanks,
            Henry