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

Re: [ydn-javascript] Autocomplete - show list onClick

Expand Messages
  • Bhushan Kumar
    Hello, Use below to instantiate autoComplete oAutoComp.autoHighlight = true; oAutoComp.typeAhead = true; oAutoComp.autoHighlight = true;
    Message 1 of 2 , Mar 30, 2009
      Hello,

      Use below to instantiate autoComplete

      oAutoComp.autoHighlight = true;
      oAutoComp.typeAhead = true;
      oAutoComp.autoHighlight = true;
      oAutoComp.delimChar=',';
      oAutoComp.forceSelection = false;

      Best,
      -BR

      On Mon, Mar 30, 2009 at 11:37 PM, alu_rd6 <alu_rd6@...> wrote:

      Hello,

      I have a working autocomplete on my page, but I don't seem to make him expand when I click inside my input box.
      Any help would be much appreciated!

      Here is the code:

      function instantiatePersonAutoComplete(oDS, inputId, autoCompleteContainer, hiddenFieldId){
      // Use a LocalDataSource
      // var oDS = new YAHOO.util.LocalDataSource(${JSON_PERSONS});
      oDS.responseSchema = {fields : ["name", "id"]};

      // Instantiate the AutoComplete
      var oAC = new YAHOO.widget.AutoComplete(inputId, autoCompleteContainer, oDS);
      oAC.resultTypeList = false;

      // enable string input contained
      oAC.queryMatchContains = true;

      // Show more results, scrolling is enabled via CSS
      oAC.maxResultsDisplayed = 100;

      // Enable force selection
      oAC.forceSelection = true;

      oAC.prehighlightClassName = "yui-ac-prehighlight";
      oAC.useShadow = true;

      // Define an event handler to populate a hidden form field
      // when an item gets selected
      var myHiddenField = YAHOO.util.Dom.get(hiddenFieldId);
      var myHandler = function(sType, aArgs) {
      var myAC = aArgs[0]; // reference back to the AC instance
      var elLI = aArgs[1]; // reference to the selected LI element
      var oData = aArgs[2]; // object literal of selected item's result data

      // update hidden form field with the selected item's ID
      myHiddenField.value = oData.id;
      };
      oAC.itemSelectEvent.subscribe(myHandler);

      }


    Your message has been successfully submitted and would be delivered to recipients shortly.