4 Replies Latest reply on Oct 5, 2007 8:17 PM by icai

    a4j:poll issues, please suggest!

    icai

      Hi Everyone,

      I have the following situation:

      I have a inline popup (overlaid div) which again opens a window popup. Whenever window popup is opened I start a polling. Polling should stop when window popup is closed. I could do this using myWindow.closed function in "onsubmit" attribute. But the problem is many a times it stops the polling at a wrong time actually before doing the job.
      I could not fix above so I let polling be opened. Inline popup has cancel/save button which will hide it.
      However if polling is open and cancel/save button are hit in the inline popup, last poll action will bring back the popup again. If you hit cancel/save second time it goes.

      How can I resolve this, I tried a lot but I have not figured out a way:

      here is part of jsp which opens polling :

      <a4j:poll action="#{backing_KnowMngmtBean.getFileName}"
       id="pollId"
       reRender="rtform:form2:sendNotification:attachFile, rtform:form2:sendNotification:mailOuterDiv"
       interval="100" onsubmit="if('#{sessionScope.fileName}' == null||'#{sessionScope.fileName}' == ''){return false;} else {return true;}"
       binding="#{backing_KnowMngmtBean.pollUI}"
       oncomplete="errorhandling();">
      </a4j:poll>


      Action Method

      public String getFileName(){
       try{
       log.info("[getFileName]");
       //reset style
       resetStyle();
       custSearchObj.strEnabled = true;
       String strFileName = "";
       if(session.getAttribute("fileName") != null)
       strFileName = (String)session.getAttribute("fileName");
      
       if((strFileName != null || !strFileName.equals("")) && !strFileName.equals("true")){
       attachedFileUI.setValue(strFileName);
       session.setAttribute("fileName","");
       }
      
       }catch(Exception e){
       isellerror = e.toString();
       e.printStackTrace();
       }
       return null;
       }