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

Autocomplete Help Please

Expand Messages
  • JD Hatton
    Hi, I am attempting to use the autocomplete module in a JSP. I copied the html from the basic remote data example and put it into a JSP file. When I click in
    Message 1 of 5 , Dec 5, 2008
    • 0 Attachment
      Hi,
        I am attempting to use the autocomplete module in a JSP. 
        I copied the html from the basic remote data example and put it into a JSP file.
        When I click in the box and type something in like "R" instead of getting the list I get the php page content.
        I checked all the pathing, etc.. 
        Any ideas on what I am doing wrong?
        
        Here is my page.

        
      Test.JSP


      <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
          pageEncoding="ISO-8859-1"%>

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
      <html> 
      <head>    
          <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
          <title>Testing Basic Remote Data XHRDataSource </title> 
       
      <style type="text/css"> 
      /*margin and padding on body element
        can introduce errors in determining
        element position and are not recommended;
        we turn them off as a foundation for YUI
        CSS treatments. */
      body {
      margin:0;
      padding:0;
      }
      </style> 
       
      <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/fonts/fonts-min.css" /> 
      <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> 
      <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/connection/connection-min.js"></script> 
      <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/animation/animation-min.js"></script> 
      <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/datasource/datasource-min.js"></script> 
      <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/autocomplete/autocomplete-min.js"></script> 
       
       
      <!--begin custom header content for this example--> 
      <style type="text/css"> 
      #myAutoComplete {
          width:25em; /* set width here or else widget will expand to fit its container */
          padding-bottom:2em;
      }
      </style> 
       
       
      <!--end custom header content for this example--> 
       
      </head> 
       
      <body class=" yui-skin-sam"> 
       
       
      <h1>Basic Remote Data</h1> 
       
      <div class="exampleIntro"> 
      </div> 
       
      <!--BEGIN SOURCE CODE FOR EXAMPLE =============================== --> 
       
      <h3>Search our database:</h3> 
      <div id="myAutoComplete"> 
      <input id="myInput" type="text"> 
      <div id="myContainer"></div> 
      </div> 
       
      <script type="text/javascript"> 
      YAHOO.example.BasicRemote = function() {
          // Use an XHRDataSource
          var oDS = new YAHOO.util.XHRDataSource("./yui_2.6.0/yui/examples/autocomplete/assets/php/ysearch_flat.php");
          // Set the responseType
          oDS.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
          // Define the schema of the delimited results
          oDS.responseSchema = {
              recordDelim: "\n",
              fieldDelim: "\t"
          };
          // Enable caching
          oDS.maxCacheEntries = 5;
       
          // Instantiate the AutoComplete
          var oAC = new YAHOO.widget.AutoComplete("myInput", "myContainer", oDS);
          
          return {
              oDS: oDS,
              oAC: oAC
          };
      }();
      </script> 
       
      <!--END SOURCE CODE FOR EXAMPLE =============================== --> 
       
       
      <!--MyBlogLog instrumentation--> 
      <script type="text/javascript" src="http://track2.mybloglog.com/js/jsserv.php?mblID=2007020704011645"></script> 
       
      </body> 
      </html> 
       
      <script type="text/javascript" src="http://us.js2.yimg.com/us.js.yimg.com/lib/rt/rto1_78.js"></script><script>var rt_page="2012402386:FRTMA"; var rt_ip="167.79.55.15"; if ("function" == typeof(rt_AddVar) ){ rt_AddVar("ys", escape("AB5B9345"));}</script><noscript><img src="http://rtb.pclick.yahoo.com/images/nojs.gif?p=2012402386:FRTMA"></noscript><script language=javascript> 
      if(window.yzq_d==null)window.yzq_d=new Object();
      window.yzq_d['0FPMKNj8fbc-']='&U=13ejcguvg%2fN%3d0FPMKNj8fbc-%2fC%3d289534.9603437.10326224.9298098%2fD%3dFOOT%2fB%3d4123617%2fV%3d1';
      <!-- VER-562 --> 
      <script language=javascript> 
      if(window.yzq_p==null)document.write("<scr"+"ipt language=javascript src=http://l.yimg.com/us.js.yimg.com/lib/bc/bc_2.0.4.js></scr"+"ipt>");
      </script><script language=javascript> 
      if(window.yzq_p)yzq_p('P=4Lgt20WTW6CAwDqqSSibVAaap083D0k2mnwAA9Dl&T=13s0g12ob%2fX%3d1228315260%2fE%3d2012402386%2fR%3ddev_net%2fK%3d5%2fV%3d1.1%2fW%3dJ%2fY%3dYAHOO%2fF%3d28515441%2fS%3d1%2fJ%3dAB5B9345');
      if(window.yzq_s)yzq_s();
      <!-- p4.ydn.sp1.yahoo.com uncompressed/chunked Wed Dec  3 06:41:00 PST 2008 --> 

         
    • JD Hatton
      I thought maybe it was the JSP that was throwing it off so I put the sample page into an html file and get the same results. Anyone have this problem? Thanks
      Message 2 of 5 , Dec 5, 2008
      • 0 Attachment
        I thought maybe it was the JSP that was throwing it off so I put the sample page into an html file and get the same results.

        Anyone have this problem?

        Thanks in advance - Jon



        On Fri, Dec 5, 2008 at 11:03 AM, JD Hatton <jdhatton@...> wrote:
        Hi,
          I am attempting to use the autocomplete module in a JSP. 
          I copied the html from the basic remote data example and put it into a JSP file.
          When I click in the box and type something in like "R" instead of getting the list I get the php page content.
          I checked all the pathing, etc.. 
          Any ideas on what I am doing wrong?
          
          Here is my page.

          
        Test.JSP


        <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
            pageEncoding="ISO-8859-1"%>

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
        <html> 
        <head>    
            <meta http-equiv="content-type" content="text/html; charset=utf-8"> 
            <title>Testing Basic Remote Data XHRDataSource </title> 
         
        <style type="text/css"> 
        /*margin and padding on body element
          can introduce errors in determining
          element position and are not recommended;
          we turn them off as a foundation for YUI
          CSS treatments. */
        body {
        margin:0;
        padding:0;
        }
        </style> 
         
        <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/fonts/fonts-min.css" /> 
        <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> 
        <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/connection/connection-min.js"></script> 
        <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/animation/animation-min.js"></script> 
        <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/datasource/datasource-min.js"></script> 
        <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/autocomplete/autocomplete-min.js"></script> 
         
         
        <!--begin custom header content for this example--> 
        <style type="text/css"> 
        #myAutoComplete {
            width:25em; /* set width here or else widget will expand to fit its container */
            padding-bottom:2em;
        }
        </style> 
         
         
        <!--end custom header content for this example--> 
         
        </head> 
         
        <body class=" yui-skin-sam"> 
         
         
        <h1>Basic Remote Data</h1> 
         
        <div class="exampleIntro"> 
        </div> 
         
        <!--BEGIN SOURCE CODE FOR EXAMPLE =============================== --> 
         
        <h3>Search our database:</h3> 
        <div id="myAutoComplete"> 
        <input id="myInput" type="text"> 
        <div id="myContainer"></div> 
        </div> 
         
        <script type="text/javascript"> 
        YAHOO.example.BasicRemote = function() {
            // Use an XHRDataSource
            var oDS = new YAHOO.util.XHRDataSource("./yui_2.6.0/yui/examples/autocomplete/assets/php/ysearch_flat.php");
            // Set the responseType
            oDS.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
            // Define the schema of the delimited results
            oDS.responseSchema = {
                recordDelim: "\n",
                fieldDelim: "\t"
            };
            // Enable caching
            oDS.maxCacheEntries = 5;
         
            // Instantiate the AutoComplete
            var oAC = new YAHOO.widget.AutoComplete("myInput", "myContainer", oDS);
            
            return {
                oDS: oDS,
                oAC: oAC
            };
        }();
        </script> 
         
        <!--END SOURCE CODE FOR EXAMPLE =============================== --> 
         
         
        <!--MyBlogLog instrumentation--> 
        <script type="text/javascript" src="http://track2.mybloglog.com/js/jsserv.php?mblID=2007020704011645"></script> 
         
        </body> 
        </html> 
         
        <script type="text/javascript" src="http://us.js2.yimg.com/us.js.yimg.com/lib/rt/rto1_78.js"></script><script>var rt_page="2012402386:FRTMA"; var rt_ip="167.79.55.15"; if ("function" == typeof(rt_AddVar) ){ rt_AddVar("ys", escape("AB5B9345"));}</script><noscript><img src="http://rtb.pclick.yahoo.com/images/nojs.gif?p=2012402386:FRTMA"></noscript><script language=javascript> 
        if(window.yzq_d==null)window.yzq_d=new Object();
        window.yzq_d['0FPMKNj8fbc-']='&U=13ejcguvg%2fN%3d0FPMKNj8fbc-%2fC%3d289534.9603437.10326224.9298098%2fD%3dFOOT%2fB%3d4123617%2fV%3d1';
        <!-- VER-562 --> 
        <script language=javascript> 
        if(window.yzq_p==null)document.write("<scr"+"ipt language=javascript src=http://l.yimg.com/us.js.yimg.com/lib/bc/bc_2.0.4.js></scr"+"ipt>");
        </script><script language=javascript> 
        if(window.yzq_p)yzq_p('P=4Lgt20WTW6CAwDqqSSibVAaap083D0k2mnwAA9Dl&T=13s0g12ob%2fX%3d1228315260%2fE%3d2012402386%2fR%3ddev_net%2fK%3d5%2fV%3d1.1%2fW%3dJ%2fY%3dYAHOO%2fF%3d28515441%2fS%3d1%2fJ%3dAB5B9345');
        if(window.yzq_s)yzq_s();
        <!-- p4.ydn.sp1.yahoo.com uncompressed/chunked Wed Dec  3 06:41:00 PST 2008 --> 

           

      • Ron Savage
        Hi Firstly, it s good manners to only post once, and then wait patiently until someone answers. Secondly: 1) Are you running this under a web server such as
        Message 3 of 5 , Dec 7, 2008
        • 0 Attachment
          Hi

          Firstly, it's good manners to only post once, and then wait patiently
          until someone answers.

          Secondly:

          1) Are you running this under a web server such as Apache?

          If not, I would not expect it to work, since you need a web server, or
          something equivalent, to execute PHP, before a PHP script will deliver
          the goods.

          2) If you are, is the script marked executable (in the Unix sense of
          setting the execute bits, if you're actually using Unix)?

          3) And/Or is the script in a directory which the web server expects to
          contain executable scripts?

          As you can see, the situation is complicated, and it's hard to know
          what you real problem is.
        • JD Hatton
          Thank you for the response.I understand about waiting patiently. I am running this on a web server. I m using Tomcat which is running Apache web http server. I
          Message 4 of 5 , Dec 7, 2008
          • 0 Attachment
            Thank you for the response.
            I understand about waiting patiently.

            I am running this on a web server. I'm using Tomcat which is running Apache web http server.
            I have all of these files under the WebContent folder where all other "pages" are located.
            If I try to run the php directly using a direct URL it opens fine.

            I tried using a text file with some words each on a new line. This shows in the drop down fine but does not go to 
            a item in the file when you type a letter. For example typing "A" should only show words starting with A but simply 
            shows everything.

            Any ideas?

            Thanks again - JD



            On Sun, Dec 7, 2008 at 4:26 PM, Ron Savage <ron@...> wrote:

            Hi

            Firstly, it's good manners to only post once, and then wait patiently
            until someone answers.

            Secondly:

            1) Are you running this under a web server such as Apache?

            If not, I would not expect it to work, since you need a web server, or
            something equivalent, to execute PHP, before a PHP script will deliver
            the goods.

            2) If you are, is the script marked executable (in the Unix sense of
            setting the execute bits, if you're actually using Unix)?

            3) And/Or is the script in a directory which the web server expects to
            contain executable scripts?

            As you can see, the situation is complicated, and it's hard to know
            what you real problem is.


          • Arun Kumar Roy
            Why cant you check in firebug what is the return of your call.
            Message 5 of 5 , Dec 7, 2008
            • 0 Attachment
              Why cant you check in firebug what is the return of your call.

              On Mon, Dec 8, 2008 at 4:34 AM, JD Hatton <jdhatton@...> wrote:

              Thank you for the response.

              I understand about waiting patiently.

              I am running this on a web server. I'm using Tomcat which is running Apache web http server.
              I have all of these files under the WebContent folder where all other "pages" are located.
              If I try to run the php directly using a direct URL it opens fine.

              I tried using a text file with some words each on a new line. This shows in the drop down fine but does not go to 
              a item in the file when you type a letter. For example typing "A" should only show words starting with A but simply 
              shows everything.

              Any ideas?

              Thanks again - JD



              On Sun, Dec 7, 2008 at 4:26 PM, Ron Savage <ron@...> wrote:

              Hi

              Firstly, it's good manners to only post once, and then wait patiently
              until someone answers.

              Secondly:

              1) Are you running this under a web server such as Apache?

              If not, I would not expect it to work, since you need a web server, or
              something equivalent, to execute PHP, before a PHP script will deliver
              the goods.

              2) If you are, is the script marked executable (in the Unix sense of
              setting the execute bits, if you're actually using Unix)?

              3) And/Or is the script in a directory which the web server expects to
              contain executable scripts?

              As you can see, the situation is complicated, and it's hard to know
              what you real problem is.



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