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

Autocomplete: Simple way to add multiple results options

Expand Messages
  • Susan
    Basically I want it to display multiple items for the field - drop down options My Code Using Coldfusion: Provider Name:
    Message 1 of 2 , Dec 6, 2006
    • 0 Attachment
      Basically I want it to display multiple items for the field - drop
      down options

      My Code Using Coldfusion:
      <td><p class="styless">Provider Name:<br><input type="text"
      name="provider_name" size="17" id="pnfield" REQUIRED="Yes"
      MESSAGE="Please Enter Provider Name" class="styless"></p>
      <DIV id="pnieldlist"></DIV></p>
      </td>
      <script type="text/javascript">
      var myArray = new Array();
      <cfquery name="ProviderName" datasource="mdforms">
      SELECT provider_name,provider_dv
      FROM Providers
      </cfquery>
      <cfoutput query="ProviderName">myArray.push
      ("#provider_name#");</cfoutput>
      var myDataSource = new YAHOO.widget.DS_JSArray
      (myArray);
      var myAutoComp = new YAHOO.widget.AutoComplete
      ("pnfield","myContainer", myDataSource);
      myAutoComp.typeAhead = true;
      myAutoComp.queryDelay = 0;
      myAutoComp.animVert = true;
      myAutoComp.autoHighlight = true;
      myAutoComp.maxResultsDisplayed = 4;

      </script>

      Thank you!!

      Susan
    • jennykhan
      Hi Susan, In order to show multiple data values in your container, you d need to write a custom formatResult function, as described here:
      Message 2 of 2 , Dec 13, 2006
      • 0 Attachment
        Hi Susan,

        In order to show multiple data values in your container, you'd need to
        write a custom formatResult function, as described here:

        http://developer.yahoo.com/yui/autocomplete/#formatting

        Also be sure to check out the areacodes example here:

        http://developer.yahoo.com/yui/examples/autocomplete/states_jsarray.html

        Hope that helps,
        Jenny




        --- In ydn-javascript@yahoogroups.com, "Susan" <susan@...> wrote:
        >
        > Basically I want it to display multiple items for the field - drop
        > down options
        >
        > My Code Using Coldfusion:
        > <td><p class="styless">Provider Name:<br><input type="text"
        > name="provider_name" size="17" id="pnfield" REQUIRED="Yes"
        > MESSAGE="Please Enter Provider Name" class="styless"></p>
        > <DIV id="pnieldlist"></DIV></p>
        > </td>
        > <script type="text/javascript">
        > var myArray = new Array();
        > <cfquery name="ProviderName" datasource="mdforms">
        > SELECT provider_name,provider_dv
        > FROM Providers
        > </cfquery>
        > <cfoutput query="ProviderName">myArray.push
        > ("#provider_name#");</cfoutput>
        > var myDataSource = new YAHOO.widget.DS_JSArray
        > (myArray);
        > var myAutoComp = new YAHOO.widget.AutoComplete
        > ("pnfield","myContainer", myDataSource);
        > myAutoComp.typeAhead = true;
        > myAutoComp.queryDelay = 0;
        > myAutoComp.animVert = true;
        > myAutoComp.autoHighlight = true;
        > myAutoComp.maxResultsDisplayed = 4;
        >
        > </script>
        >
        > Thank you!!
        >
        > Susan
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.