4 Replies Latest reply on Apr 23, 2008 9:51 PM by bostone

    Hash is not a constructor

    bostone

      I'm using latest Richfaces 3.2.0.SR1 release in myfaces/facelets app. All pages are XHTML. I tried rich modal panel and it works just fine. However when I try to put a simpleTogglePanel anywhere on the page it is rendered OK but I see the following error message in the firebug

      Hash is not a constructor
      http://localhost:8080/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript.faces
      inspect()a4j_3_2_0.SR1-SNA... (line 57)
      initialize(Object userGroupRoleForm:addRolesPanel=Object)a4j_3_2_0.SR1-SNA... (line 55)
      add(Object panelId=userGroupRoleForm:addRolesPanel)simpleTogglePanel... (line 15)
      [Break on this error] return toQueryPair(key,values);}).join('&');},inspect:function(){return'#<Hash:{...
      Line 57

      Then if I click on toggle icon it issues another error (and it doesn't hide the panel)
      this.panels.get(panelId) has no properties
      http://localhost:8080/namsNG/a4j_3_2_0.SR1-SNAPSHOTscripts/simpleTogglePanel.js.faces
      Line 19
      toggleOnClient(click clientX=0, clientY=0, "userGroupRoleForm:addRolesPanel")simpleTogglePanel... (line 19)
      onclick(click clientX=0, clientY=0)login.faces (line 1)
      [Break on this error] SimpleTogglePanelManager.toggleOnClient=function(event,panelId){this.panels.get(...

      Here's panel code
      <rich:simpleTogglePanel id="addRolesPanel" switchType="client" label="Assign Roles and Groups">
       Blah
       </rich:simpleTogglePanel>


        • 1. Re: Hash is not a constructor
          bostone

          OK, I know what the issue is. The page was already using prototype.js, so after removing script tag link to the prototype.js simple panel works as advertised. However, my JS code that was relying on prototype.js is now broken. For example, I see this error:

          Class is not defined
          var Validator = Class.create();

          The version of prototype.js I'm using is 1.5.0_rc2 from scriptaculous distribution.
          Can you guys point to some documentation or just simply explain how to migrate my existing prototype code to not clash with richfaces?

          • 2. Re: Hash is not a constructor
            bostone

            If anyone interested - It seems that simply providing a namespace for richfaces is not enough to load JS files. My stuff started working again after I:
            1. Removed old script tag that was loading prototype.js
            2. Placed at least one richfaces tag onto page (like rich:panel)
            Voila - my old scripts came back to life

            • 3. Re: Hash is not a constructor

              Richfaces loads script on-demand. No components to use it, no loading.


              However, you load the script explicitly if needs.

              See: http://livedemo.exadel.com/richfaces-demo/richfaces/script.jsf

              Try src="resource://prototype.js"

              • 4. Re: Hash is not a constructor
                bostone

                Thanks, I was looking at that. But since I'm planing on adding rich components to all my pages this shouldn't be an issue anyway