2 Replies Latest reply on Jun 11, 2007 8:02 AM by ilya_shaikovsky

    Req is undefined Error in ajaxSupport

    joshro

      I'm attempting to use ajaxSupport within a custom jsf component. It all works as expected except for this one random error.

      When entering text within the autocomplete box that uses ajaxSupport sometimes this javascript error occurs:
      Error 'req' is undefined

      When I go into debug the javascript it brings me to this line of code:
      A4J.AJAX.status(req.containerId,req.options.status,false)

      Has anyone had a similar issue?

      What other information would helpful in attempting to determine the problem?

      Below is an excerpt on how I'm defining the AjaxSupport call within my custom component.

       HtmlAjaxSupport support = new HtmlAjaxSupport();
       support.setId(input.getId() + "as");
       support.setEvent("onkeyup");
       support.addActionListener((ActionListener) this);
       support.setIgnoreDupResponses(true);
       support.setRequestDelay(500);
       support.setReRender(component.getId() + "_sr");
       support.setValueBinding("listProvider", listProvider);
       support.setBypassUpdates(true);
       support.setLimitToList(true);
      
      


      Thank you,

        • 1. Re: Req is undefined Error in ajaxSupport
          joshro

          Additional Information:

          It looks as if the abort function is being called and that is where the req is undefined. Does that help pinpoint the problem any? It happens when hitting the keys over and over quickly.

          The BOLD line is what causes the error message occurs.
          See the Javascript below from AJAX.js

          abort: function(){
           if(!this._aborted){
           A4J.AJAX.status(req.containerId,req.options.status,false);
           if(typeof(A4J.AJAX['onAbort']) == "function"){
           A4J.AJAX['onAbort'](this);
           }
           }
           this._aborted=true;
           if(this._request){
           try{
           this._request.abort();
           if(this._timeoutID){
           window.clearTimeout(this._timeoutID);
           }
           } catch (e){
           LOG.warn("Exception for abort current request "+e.Message)
           }
           }}
          
          


          • 2. Re: Req is undefined Error in ajaxSupport
            ilya_shaikovsky

            use requestDelay and ignoreDupResponse attributes