Loading ...
Sorry, an error occurred while loading the content.

Autocomplete Combobox not rendering in IE7

Expand Messages
  • arambulo81
    I posted this on Friday but managed to get it narrowed down a little more since then. This is my JS file. The error message only says it s expecting an object.
    Message 1 of 3 , Feb 2, 2009
    View Source
    • 0 Attachment
      I posted this on Friday but managed to get it narrowed down a little more since then.

      This is my JS file. The error message only says it's expecting an object. When I comment out blocks of code, I found the code to run until it returns the below values:

          return {
              tDS: tDS,
              tAC: tAC,
          }


      Below is my full JS code. It is (mostly) taken directly from the YUI Combobox Example. The AJAX request returns a JSON Array wrapped in a JSON Object ( { cannedTalk : { jsonarrayofstrings } } ) :

      var inputId;
      var containerId;
      var toggleId;

      function initComboBox(url, inputid, containerid, toggleid, options ) {
          inputId = inputid;
          containerId = containerid;
          toggleId = toggleid;
          var onFailure = function( callbackResponse ) {
              alert( "OOPS: " + callbackResponse );
          }   
          YAHOO.util.Connect.asyncRequest('GET', url, {success:loadTalk,failure:onFailure}, null);
      }

      function loadTalk(callbackResponse) {
          var myJSON = YAHOO.lang.JSON.parse(callbackResponse.responseText);

          // Instantiate DataSources
          var tDS = new YAHOO.util.LocalDataSource(myJSON.cannedTalk);

          // Instantiate AutoCompletes
          var oConfigs = {
              prehighlightClassName: "yui-ac-prehighlight",
              useShadow: true,
              queryDelay: 0,
              minQueryLength: 0,
              animVert: .01
          }
          var tAC = new YAHOO.widget.AutoComplete(inputId, containerId, tDS, oConfigs);
          // combobox
          var tToggler = YAHOO.util.Dom.get(toggleId);
          var oPushButtonT = new YAHOO.widget.Button({container:tToggler});
          var toggleT = function(e) {
              //YAHOO.util.Event.stopEvent(e);
              if(!YAHOO.util.Dom.hasClass(tToggler, "open")) {
                  YAHOO.util.Dom.addClass(tToggler, "open")
              }
              // Is open
              if(tAC.isContainerOpen()) {
                  tAC.collapseContainer();
              }
              // Is closed
              else {
                  tAC.getInputEl().focus(); // Needed to keep widget active
                  setTimeout(function() { // For IE
                      tAC.sendQuery("");
                  },0);
              }
          }
          oPushButtonT.on("click", toggleT);
          tAC.containerCollapseEvent.subscribe(function(){YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get(toggleId), "open")});
         

          return {
              tDS: tDS,
              tAC: tAC,
          }
      }

    • arambulo81
      Also, I added alerts to the bottom and traced them through the code to just before the return. tDS: not Null tAC: not Null oPushButtonT: not Null
      Message 2 of 3 , Feb 2, 2009
      View Source
      • 0 Attachment
        Also, I added alerts to the bottom and traced them through the code to
        just before the return.

        tDS: not Null
        tAC: not Null
        oPushButtonT: not Null
        tAC.collapseContainerEvent: not Null
      • arambulo81
        No idea what fixed it,probably a YUI Loading Order tweak, but I don t remember.
        Message 3 of 3 , Feb 2, 2009
        View Source
        • 0 Attachment
          No idea what fixed it,probably a YUI Loading Order tweak, but I don't
          remember.
        Your message has been successfully submitted and would be delivered to recipients shortly.