0 Replies Latest reply on Jan 15, 2009 5:59 PM by P B

    Problem with onload.js and seam calls no working (works locally only)

    P B Newbie
      __HI,

      I am working in the seam/jboss environment. We have counter for a game that tracks the user's experience points, levels and currency. I have the javascript code and seam elements that work locally using " body onload"

      This works as long as the javascript is on the page locally in the body tag:
      <body
      onload="setLevelCounter(#{e:getLevel(currentUser)}); setXpCounter(#{currentUser.experience}); setCogsCounter(#{currentUser.credits}); populateAvatarDropList();">

      While they work putting locally on the page in the body tag. I would like to link them from .js and use just one function.

      The onload.js looks like this:

      Same code but does not work when put in js and tried to access remotely:
      function loadFunctions() {
      javascript:setLevelCounter(#{e:getLevel(currentUser)}); javascript:setXpCounter(#{currentUser.experience}); javascript:setCogsCounter(#{currentUser.credits});
      populateAvatarDropList();

      }

      then in the html page I call the function with
      <body onload="loadFunctions()">

      onload.js worked when I was testing and using hardcoded numbers like this:

      //the onload event
      function loadFunctions() {
      setLevelCounter(13);
      setXpCounter(2687);
      setCogsCounter(47945);
      populateAvatarDropList();

      }

      As soon as the seam calls are added the only it will only work and pull the data is if it is put locally on the page in the body tag:
      Like this: (same as first code example posted)

      <body
      onload="setLevelCounter(#{e:getLevel(currentUser)}); setXpCounter(#{currentUser.experience}); setCogsCounter(#{currentUser.credits}); populateAvatarDropList();">

      ----------------

      If you have any suggestions, recommendations or advice on what I am doing wrong I would greatly appreciate the feedback.

      Thank you