1 Reply Latest reply on Feb 17, 2008 7:03 AM by Ilya Shaikovsky

    a4j:poll, reRender and javascript issue.

    P K Newbie

      I am noticing a weird javascript error on my page which resembles a dashboard thats updated perodically using the a4j:poll tag and reRender attribute.

      Here is what I have in my JSP:

       <h:form id="dashboard_poll">
       <a4j:poll id="flicker" action="#{dashboardBean.readDashboardStats}" interval="30000" />
       <h:form id="dashboard">
       <a4j:outputPanel ajaxRendered="true">
       <h:commandButton id="assignButton" value="Assign" onclick="return validate();" />
       <h:commandLink id="assignLink" style="display:none;" action="#{someOtherBean.makeAssignment}" >
       <f:param name="assignId" id="assignId" value="112233"/>

      Here is the javascript:

      function validate() {
       return false;

      The first time page loads and I click the Assign command button, everything works fine....the page transitions occur like clockwork. However if I dont click on anything and allow the <a4j:poll> to rerender the components and then click the button, I get a javascript error with some ridiculous message "Object Expected Line: 1 Char: 1"

      I dug through with alerts etc and figured its before trying to call the "clearFormHiddenParams_dashboard('dashboard')" method. I guess this method is included by default for all <h:form> elements.

      Has anyone seen something similar.....Am I doing something incorrectly to be seeing this error? Thanks in advance

        • 1. Re: a4j:poll, reRender and javascript issue.
          Ilya Shaikovsky Master

          At first your construction seems strange.. Why you can't just use one control instead of two ones.. And why it's h:command* ones instead of a4j:command? You really need to perform full page refresh instead of just ajax-ed validation and together with polling?

          And about js error - try to usea4j:htmlCommandLink instead of h: one.. It works better with nessesarry hidden fields and ajax requests.