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

Re: Autocomplete submits form with [enter] or mouse click

Expand Messages
  • tivacus
    ... After creating an autocomplete object ( autoComplete ) I subscribed to the itemSelectEvent event with a function.
    Message 1 of 10 , Jun 1, 2006
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@...>
      wrote:
      >
      > Hey everyone,
      >
      > I'd like to leverage this new technology on our website, but am having
      > a bit of trouble getting it to function the way I'd like. Any
      > suggestions or help would be great. I have gotten the actual Auto
      > complete widget to work, but I'd like to have it submit my form when
      > someone either clicks the result from the popup, or presses the
      > [enter] key on the keyboard.
      >
      > I have been able to do this by setting an onblur in the input field,
      > but this only works with mouse click. As well, it only submits what
      > the user typed, not what the auto complete stuck in there.
      >
      > I've tried adding a timeout before the form submit in hopes that it
      > was just submitting too fast. If anyone has any insight, I'd be most
      > grateful.
      >
      > Thanks in advance to anyone and everyone.
      >

      After creating an autocomplete object ("autoComplete") I subscribed to
      the itemSelectEvent event with a function.

      autoComplete.itemSelectEvent.subscribe(onItemSelect);

      From there it's a matter of providing the onItemSelect function and
      having that submit the form.

      function onItemSelect(sType, aArgs)
      {
      YAHOO.util.Dom.get("searchForm").submit();
      }
    • tivacus
      ... In response to Matthew s email asking for more clarification I ll post a code snippet that should do what he s requesting. //wrapper for initialization
      Message 2 of 10 , Jun 2, 2006
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@...>
        wrote:
        >
        > Hey everyone,
        >
        > I'd like to leverage this new technology on our website, but am having
        > a bit of trouble getting it to function the way I'd like. Any
        > suggestions or help would be great. I have gotten the actual Auto
        > complete widget to work, but I'd like to have it submit my form when
        > someone either clicks the result from the popup, or presses the
        > [enter] key on the keyboard.
        >
        > I have been able to do this by setting an onblur in the input field,
        > but this only works with mouse click. As well, it only submits what
        > the user typed, not what the auto complete stuck in there.
        >
        > I've tried adding a timeout before the form submit in hopes that it
        > was just submitting too fast. If anyone has any insight, I'd be most
        > grateful.
        >
        > Thanks in advance to anyone and everyone.
        >
        In response to Matthew's email asking for more clarification I'll post
        a code snippet that should do what he's requesting.

        //wrapper for initialization methods
        function init() {
        //set up remote data source
        var dataSource =
        new YAHOO.widget.DS_XHR("autocomplete.php", ["Result", "name"]);

        //create autocomplete widget
        var autoComplete =
        new YAHOO.widget.AutoComplete('searchBox',
        'resultsContainer',
        dataSource);

        //subscribe to the custom event of them selecting an item
        //so we can submit the form
        autoComplete.itemSelectEvent.subscribe(onItemSelect);
        }

        //listener that responds when an item is selected (mouse or keyboard)
        function onItemSelect(sType, aArgs) {
        //find the form in the dom and submit it
        YAHOO.util.Dom.get("searchForm").submit();
        }

        //start once page has loaded
        YAHOO.util.Event.addListener(window, 'load', init);

        Hopefully that should clear up where each element comes from.
      • Matthew
        Thank you for your reply! I have gotten this to work and it submits my form, but the form only submits what the user typed and not what the auto complete has
        Message 3 of 10 , Jun 7, 2006
        • 0 Attachment
          Thank you for your reply!

          I have gotten this to work and it submits my form, but the form only
          submits what the user typed and not what the auto complete has stuck
          into the box.

          If anyone can help me debug this, it would be greatly appreciated.




          --- In ydn-javascript@yahoogroups.com, "tivacus" <pcavit@...> wrote:
          >
          > --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@>
          > wrote:
          > >
          > > Hey everyone,
          > >
          > > I'd like to leverage this new technology on our website, but am
          having
          > > a bit of trouble getting it to function the way I'd like. Any
          > > suggestions or help would be great. I have gotten the actual Auto
          > > complete widget to work, but I'd like to have it submit my form
          when
          > > someone either clicks the result from the popup, or presses the
          > > [enter] key on the keyboard.
          > >
          > > I have been able to do this by setting an onblur in the input
          field,
          > > but this only works with mouse click. As well, it only submits
          what
          > > the user typed, not what the auto complete stuck in there.
          > >
          > > I've tried adding a timeout before the form submit in hopes that
          it
          > > was just submitting too fast. If anyone has any insight, I'd be
          most
          > > grateful.
          > >
          > > Thanks in advance to anyone and everyone.
          > >
          > In response to Matthew's email asking for more clarification I'll
          post
          > a code snippet that should do what he's requesting.
          >
          > //wrapper for initialization methods
          > function init() {
          > //set up remote data source
          > var dataSource =
          > new YAHOO.widget.DS_XHR("autocomplete.php",
          ["Result", "name"]);
          >
          > //create autocomplete widget
          > var autoComplete =
          > new YAHOO.widget.AutoComplete('searchBox',
          > 'resultsContainer',
          > dataSource);
          >
          > //subscribe to the custom event of them selecting an item
          > //so we can submit the form
          > autoComplete.itemSelectEvent.subscribe(onItemSelect);
          > }
          >
          > //listener that responds when an item is selected (mouse or
          keyboard)
          > function onItemSelect(sType, aArgs) {
          > //find the form in the dom and submit it
          > YAHOO.util.Dom.get("searchForm").submit();
          > }
          >
          > //start once page has loaded
          > YAHOO.util.Event.addListener(window, 'load', init);
          >
          > Hopefully that should clear up where each element comes from.
          >
        • tivacus
          ... Odd, mine fills in the autocomplete data before submitting. Could it be some weirdness with your data transport method? I m using JSON and it s working
          Message 4 of 10 , Jun 7, 2006
          • 0 Attachment
            --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@...>
            wrote:
            >
            > Thank you for your reply!
            >
            > I have gotten this to work and it submits my form, but the form only
            > submits what the user typed and not what the auto complete has stuck
            > into the box.
            >
            > If anyone can help me debug this, it would be greatly appreciated.
            >

            Odd, mine fills in the autocomplete data before submitting. Could it
            be some weirdness with your data transport method? I'm using JSON and
            it's working as expected here. Failing that you could always do it
            manually in the onItemSelect callback. Just add some code to set the
            value of the search box to whatever the item selected's value was.
            Should be doable with an extra line before you submit the form.
          • Matthew
            ... only ... stuck ... it ... and ... the ... Tivacus, Thank you for your replies... I appreciate your help through this difficult learning process. I ve
            Message 5 of 10 , Jun 9, 2006
            • 0 Attachment
              --- In ydn-javascript@yahoogroups.com, "tivacus" <pcavit@...> wrote:
              >
              > --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@>
              > wrote:
              > >
              > > Thank you for your reply!
              > >
              > > I have gotten this to work and it submits my form, but the form
              only
              > > submits what the user typed and not what the auto complete has
              stuck
              > > into the box.
              > >
              > > If anyone can help me debug this, it would be greatly appreciated.
              > >
              >
              > Odd, mine fills in the autocomplete data before submitting. Could
              it
              > be some weirdness with your data transport method? I'm using JSON
              and
              > it's working as expected here. Failing that you could always do it
              > manually in the onItemSelect callback. Just add some code to set
              the
              > value of the search box to whatever the item selected's value was.
              > Should be doable with an extra line before you submit the form.
              >


              Tivacus,

              Thank you for your replies... I appreciate your help through this
              difficult learning process. I've tried just about every thing I can
              think of under the sun to set the text box value to item selected.
              Here is my code. Can you please point out where the error lies and
              how to select the autocomplete value?

              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

              <html>
              <head>
              <title>Untitled</title>
              <!-- Dependencies -->
              <script src="/includes/yahoo.js"></script>
              <script src="/includes/dom.js"></script>
              <script src="/includes/event.js"></script>
              <!-- OPTIONAL: Animation (required only if enabling animation) -->
              <script src="/includes/animation.js"></script>
              <!-- Source file -->
              <script src="/includes/autocomplete.js"></script>
              <style>
              div#myContainer {z-Index: 10000; position: absolute; top: 50px; left:
              564px; padding: 5px; width: 200px; border: 1px Black Solid;
              background: #cccccc; color: #000000}
              div#myContainer ul,li {padding:0;margin:0;}
              li.myClass {background: #ffffff;}
              </style>


              </head>

              <body>
              <form action="http://intuitsearch.intuit.com/search" method="get"
              id="searchForm" autocomplete="off"><input value="xml_no_dtd"
              name="output" type="hidden"><input value="accountant_site"
              name="client" type="hidden"><input value="accountant_site"
              name="site" type="hidden"><input value="accountant_site"
              name="proxystylesheet" type="hidden"><input value="10" name="num"
              type="hidden"><input name="q" id="q" type="text" class="searchbox"
              onchange="onItemSelect();">  <input type="image"
              src="/images/homepage/btn-search.gif" alt="Search" width="70"
              height="20" border="0"></form>
              <div id="myContainer"></div>
              <script>

              function init () {
              var myArray = ["QuickBooks Pro", "QuickBooks Premier", "QuickBooks
              Accountant Edition"];
              var myDataSource1 = new YAHOO.widget.DS_JSArray(myArray);
              var autoComplete = new YAHOO.widget.AutoComplete('q','myContainer',
              myDataSource1);
              // Use a custom class for LI elements
              autoComplete.highlightClassName = "myClass";
              autoComplete.itemSelectEvent.subscribe(onItemSelect);
              }

              function onItemSelect(sType, aArgs) {
              //set the value manually
              YAHOO.util.Dom.get("q").value =
              YAHOO.widget.AutoComplete.itemSelectEvent.value();
              //find the form in the dom and submit it
              YAHOO.util.Dom.get("searchForm").submit();
              }
              YAHOO.util.Event.addListener(window, 'load', init);


              </script>
              </body>
              </html>
            • Matthew
              ... only ... stuck ... it ... and ... the ... tivacus, thank you for your replies. below is my code that is not working. I do not understand how you find the
              Message 6 of 10 , Jun 9, 2006
              • 0 Attachment
                --- In ydn-javascript@yahoogroups.com, "tivacus" <pcavit@...> wrote:
                >
                > --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@>
                > wrote:
                > >
                > > Thank you for your reply!
                > >
                > > I have gotten this to work and it submits my form, but the form
                only
                > > submits what the user typed and not what the auto complete has
                stuck
                > > into the box.
                > >
                > > If anyone can help me debug this, it would be greatly appreciated.
                > >
                >
                > Odd, mine fills in the autocomplete data before submitting. Could
                it
                > be some weirdness with your data transport method? I'm using JSON
                and
                > it's working as expected here. Failing that you could always do it
                > manually in the onItemSelect callback. Just add some code to set
                the
                > value of the search box to whatever the item selected's value was.
                > Should be doable with an extra line before you submit the form.
                >

                tivacus, thank you for your replies. below is my code that is not
                working. I do not understand how you find the autocomplete selected
                value and set the text box value.

                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


                <head>
                <title>Untitled</title>
                <!-- Dependencies -->
                <script src="/includes/yahoo.js"></script>
                <script src="/includes/dom.js"></script>
                <script src="/includes/event.js"></script>
                <!-- OPTIONAL: Animation (required only if enabling animation) -->
                <script src="/includes/animation.js"></script>
                <!-- Source file -->
                <script src="/includes/autocomplete.js"></script>
                <style>
                div#myContainer {z-Index: 10000; position: absolute; top: 50px; left:
                564px; padding: 5px; width: 200px; border: 1px Black Solid;
                background: #cccccc; color: #000000}
                div#myContainer ul,li {padding:0;margin:0;}
                li.myClass {background: #ffffff;}
                </style>


                </head>

                <body>
                <form action="http://intuitsearch.intuit.com/search" method="get"
                id="searchForm" autocomplete="off"><input value="xml_no_dtd"
                name="output" type="hidden"><input value="accountant_site"
                name="client" type="hidden"><input value="accountant_site"
                name="site" type="hidden"><input value="accountant_site"
                name="proxystylesheet" type="hidden"><input value="10" name="num"
                type="hidden"><input name="q" id="q" type="text" class="searchbox"
                onchange="onItemSelect();">  <input type="image"
                src="/images/homepage/btn-search.gif" alt="Search" width="70"
                height="20" border="0"></form>
                <div id="myContainer"></div>
                <script>

                function init () {
                var myArray = ["QuickBooks Pro", "QuickBooks Premier", "QuickBooks
                Accountant Edition"];
                var myDataSource1 = new YAHOO.widget.DS_JSArray(myArray);
                var autoComplete = new YAHOO.widget.AutoComplete('q','myContainer',
                myDataSource1);
                // Use a custom class for LI elements
                autoComplete.highlightClassName = "myClass";
                autoComplete.itemSelectEvent.subscribe(onItemSelect);
                }

                function onItemSelect(sType, aArgs) {
                //set the value manually
                YAHOO.util.Dom.get("q").value =
                YAHOO.widget.AutoComplete.itemSelectEvent.value();
                //find the form in the dom and submit it
                YAHOO.util.Dom.get("searchForm").submit();
                }
                YAHOO.util.Event.addListener(window, 'load', init);


                </script>
                </body>
              • jennykhan
                Hi Matthew, Have you tried something like this? function onItemSelect(sType, aArgs) { //populate the textbox with the selection
                Message 7 of 10 , Jun 19, 2006
                • 0 Attachment
                  Hi Matthew,

                  Have you tried something like this?

                  function onItemSelect(sType, aArgs) {
                  //populate the textbox with the selection
                  YAHOO.util.Dom.get("searchBox").value = aArgs[1].innerText;
                  //find the form in the dom and submit it
                  YAHOO.util.Dom.get("searchForm").submit();
                  }

                  Jenny



                  --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@...>
                  wrote:
                  >
                  > --- In ydn-javascript@yahoogroups.com, "tivacus" <pcavit@> wrote:
                  > >
                  > > --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@>
                  > > wrote:
                  > > >
                  > > > Thank you for your reply!
                  > > >
                  > > > I have gotten this to work and it submits my form, but the form
                  > only
                  > > > submits what the user typed and not what the auto complete has
                  > stuck
                  > > > into the box.
                  > > >
                  > > > If anyone can help me debug this, it would be greatly appreciated.
                  > > >
                  > >
                  > > Odd, mine fills in the autocomplete data before submitting. Could
                  > it
                  > > be some weirdness with your data transport method? I'm using JSON
                  > and
                  > > it's working as expected here. Failing that you could always do it
                  > > manually in the onItemSelect callback. Just add some code to set
                  > the
                  > > value of the search box to whatever the item selected's value was.
                  > > Should be doable with an extra line before you submit the form.
                  > >
                  >
                  > tivacus, thank you for your replies. below is my code that is not
                  > working. I do not understand how you find the autocomplete selected
                  > value and set the text box value.
                  >
                  > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                  >
                  >
                  > <head>
                  > <title>Untitled</title>
                  > <!-- Dependencies -->
                  > <script src="/includes/yahoo.js"></script>
                  > <script src="/includes/dom.js"></script>
                  > <script src="/includes/event.js"></script>
                  > <!-- OPTIONAL: Animation (required only if enabling animation) -->
                  > <script src="/includes/animation.js"></script>
                  > <!-- Source file -->
                  > <script src="/includes/autocomplete.js"></script>
                  > <style>
                  > div#myContainer {z-Index: 10000; position: absolute; top: 50px; left:
                  > 564px; padding: 5px; width: 200px; border: 1px Black Solid;
                  > background: #cccccc; color: #000000}
                  > div#myContainer ul,li {padding:0;margin:0;}
                  > li.myClass {background: #ffffff;}
                  > </style>
                  >
                  >
                  > </head>
                  >
                  > <body>
                  > <form action="http://intuitsearch.intuit.com/search" method="get"
                  > id="searchForm" autocomplete="off"><input value="xml_no_dtd"
                  > name="output" type="hidden"><input value="accountant_site"
                  > name="client" type="hidden"><input value="accountant_site"
                  > name="site" type="hidden"><input value="accountant_site"
                  > name="proxystylesheet" type="hidden"><input value="10" name="num"
                  > type="hidden"><input name="q" id="q" type="text" class="searchbox"
                  > onchange="onItemSelect();">  <input type="image"
                  > src="/images/homepage/btn-search.gif" alt="Search" width="70"
                  > height="20" border="0"></form>
                  > <div id="myContainer"></div>
                  > <script>
                  >
                  > function init () {
                  > var myArray = ["QuickBooks Pro", "QuickBooks Premier", "QuickBooks
                  > Accountant Edition"];
                  > var myDataSource1 = new YAHOO.widget.DS_JSArray(myArray);
                  > var autoComplete = new YAHOO.widget.AutoComplete('q','myContainer',
                  > myDataSource1);
                  > // Use a custom class for LI elements
                  > autoComplete.highlightClassName = "myClass";
                  > autoComplete.itemSelectEvent.subscribe(onItemSelect);
                  > }
                  >
                  > function onItemSelect(sType, aArgs) {
                  > //set the value manually
                  > YAHOO.util.Dom.get("q").value =
                  > YAHOO.widget.AutoComplete.itemSelectEvent.value();
                  > //find the form in the dom and submit it
                  > YAHOO.util.Dom.get("searchForm").submit();
                  > }
                  > YAHOO.util.Event.addListener(window, 'load', init);
                  >
                  >
                  > </script>
                  > </body>
                  >
                • Matthew
                  function onItemSelect(sType, aArgs) { //populate the textbox with the selection YAHOO.util.Dom.get( myInput ).value = aArgs[1].innerText; //find the form in
                  Message 8 of 10 , Jun 20, 2006
                  • 0 Attachment
                    function onItemSelect(sType, aArgs) {
                    //populate the textbox with the selection
                    YAHOO.util.Dom.get("myInput").value = aArgs[1].innerText;
                    //find the form in the dom and submit it
                    YAHOO.util.Dom.get("searchForm").submit();
                    }

                    This returns "undefined" in the text box. Any ideas on why this is
                    happening?

                    --- In ydn-javascript@yahoogroups.com, "jennykhan" <jennyhan@...> wrote:
                    >
                    > Hi Matthew,
                    >
                    > Have you tried something like this?
                    >
                    > function onItemSelect(sType, aArgs) {
                    > //populate the textbox with the selection
                    > YAHOO.util.Dom.get("searchBox").value = aArgs[1].innerText;
                    > //find the form in the dom and submit it
                    > YAHOO.util.Dom.get("searchForm").submit();
                    > }
                    >
                    > Jenny
                    >
                    >
                    >
                    > --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@>
                    > wrote:
                    > >
                    > > --- In ydn-javascript@yahoogroups.com, "tivacus" <pcavit@> wrote:
                    > > >
                    > > > --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@>
                    > > > wrote:
                    > > > >
                    > > > > Thank you for your reply!
                    > > > >
                    > > > > I have gotten this to work and it submits my form, but the form
                    > > only
                    > > > > submits what the user typed and not what the auto complete has
                    > > stuck
                    > > > > into the box.
                    > > > >
                    > > > > If anyone can help me debug this, it would be greatly appreciated.
                    > > > >
                    > > >
                    > > > Odd, mine fills in the autocomplete data before submitting. Could
                    > > it
                    > > > be some weirdness with your data transport method? I'm using JSON
                    > > and
                    > > > it's working as expected here. Failing that you could always do it
                    > > > manually in the onItemSelect callback. Just add some code to set
                    > > the
                    > > > value of the search box to whatever the item selected's value was.
                    > > > Should be doable with an extra line before you submit the form.
                    > > >
                    > >
                    > > tivacus, thank you for your replies. below is my code that is not
                    > > working. I do not understand how you find the autocomplete selected
                    > > value and set the text box value.
                    > >
                    > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                    > >
                    > >
                    > > <head>
                    > > <title>Untitled</title>
                    > > <!-- Dependencies -->
                    > > <script src="/includes/yahoo.js"></script>
                    > > <script src="/includes/dom.js"></script>
                    > > <script src="/includes/event.js"></script>
                    > > <!-- OPTIONAL: Animation (required only if enabling animation) -->
                    > > <script src="/includes/animation.js"></script>
                    > > <!-- Source file -->
                    > > <script src="/includes/autocomplete.js"></script>
                    > > <style>
                    > > div#myContainer {z-Index: 10000; position: absolute; top: 50px; left:
                    > > 564px; padding: 5px; width: 200px; border: 1px Black Solid;
                    > > background: #cccccc; color: #000000}
                    > > div#myContainer ul,li {padding:0;margin:0;}
                    > > li.myClass {background: #ffffff;}
                    > > </style>
                    > >
                    > >
                    > > </head>
                    > >
                    > > <body>
                    > > <form action="http://intuitsearch.intuit.com/search" method="get"
                    > > id="searchForm" autocomplete="off"><input value="xml_no_dtd"
                    > > name="output" type="hidden"><input value="accountant_site"
                    > > name="client" type="hidden"><input value="accountant_site"
                    > > name="site" type="hidden"><input value="accountant_site"
                    > > name="proxystylesheet" type="hidden"><input value="10" name="num"
                    > > type="hidden"><input name="q" id="q" type="text" class="searchbox"
                    > > onchange="onItemSelect();">  <input type="image"
                    > > src="/images/homepage/btn-search.gif" alt="Search" width="70"
                    > > height="20" border="0"></form>
                    > > <div id="myContainer"></div>
                    > > <script>
                    > >
                    > > function init () {
                    > > var myArray = ["QuickBooks Pro", "QuickBooks Premier", "QuickBooks
                    > > Accountant Edition"];
                    > > var myDataSource1 = new YAHOO.widget.DS_JSArray(myArray);
                    > > var autoComplete = new YAHOO.widget.AutoComplete('q','myContainer',
                    > > myDataSource1);
                    > > // Use a custom class for LI elements
                    > > autoComplete.highlightClassName = "myClass";
                    > > autoComplete.itemSelectEvent.subscribe(onItemSelect);
                    > > }
                    > >
                    > > function onItemSelect(sType, aArgs) {
                    > > //set the value manually
                    > > YAHOO.util.Dom.get("q").value =
                    > > YAHOO.widget.AutoComplete.itemSelectEvent.value();
                    > > //find the form in the dom and submit it
                    > > YAHOO.util.Dom.get("searchForm").submit();
                    > > }
                    > > YAHOO.util.Event.addListener(window, 'load', init);
                    > >
                    > >
                    > > </script>
                    > > </body>
                    > >
                    >
                  • jennykhan
                    Hi Matthew, That s strange -- your code works for me. You should remove the onchange= onItemSelect(); from your input box since you are using a Custom Event
                    Message 9 of 10 , Jun 29, 2006
                    • 0 Attachment
                      Hi Matthew,

                      That's strange -- your code works for me. You should remove the
                      onchange="onItemSelect();" from your input box since you are using a
                      Custom Event for this functionality. I'd even say that you don't need
                      onItemSelect at all. What OS/browser are you having problems on?

                      Jenny



                      --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@...>
                      wrote:
                      >
                      > function onItemSelect(sType, aArgs) {
                      > //populate the textbox with the selection
                      > YAHOO.util.Dom.get("myInput").value = aArgs[1].innerText;
                      > //find the form in the dom and submit it
                      > YAHOO.util.Dom.get("searchForm").submit();
                      > }
                      >
                      > This returns "undefined" in the text box. Any ideas on why this is
                      > happening?
                      >
                      > --- In ydn-javascript@yahoogroups.com, "jennykhan" <jennyhan@> wrote:
                      > >
                      > > Hi Matthew,
                      > >
                      > > Have you tried something like this?
                      > >
                      > > function onItemSelect(sType, aArgs) {
                      > > //populate the textbox with the selection
                      > > YAHOO.util.Dom.get("searchBox").value = aArgs[1].innerText;
                      > > //find the form in the dom and submit it
                      > > YAHOO.util.Dom.get("searchForm").submit();
                      > > }
                      > >
                      > > Jenny
                      > >
                      > >
                      > >
                      > > --- In ydn-javascript@yahoogroups.com, "Matthew" <matthew_gisonno@>
                      > > wrote:
                      > > >
                      > > > --- In ydn-javascript@yahoogroups.com, "tivacus" <pcavit@> wrote:
                      > > > >
                      > > > > --- In ydn-javascript@yahoogroups.com, "Matthew"
                      <matthew_gisonno@>
                      > > > > wrote:
                      > > > > >
                      > > > > > Thank you for your reply!
                      > > > > >
                      > > > > > I have gotten this to work and it submits my form, but the form
                      > > > only
                      > > > > > submits what the user typed and not what the auto complete has
                      > > > stuck
                      > > > > > into the box.
                      > > > > >
                      > > > > > If anyone can help me debug this, it would be greatly
                      appreciated.
                      > > > > >
                      > > > >
                      > > > > Odd, mine fills in the autocomplete data before submitting.
                      Could
                      > > > it
                      > > > > be some weirdness with your data transport method? I'm using
                      JSON
                      > > > and
                      > > > > it's working as expected here. Failing that you could always
                      do it
                      > > > > manually in the onItemSelect callback. Just add some code to set
                      > > > the
                      > > > > value of the search box to whatever the item selected's value
                      was.
                      > > > > Should be doable with an extra line before you submit the form.
                      > > > >
                      > > >
                      > > > tivacus, thank you for your replies. below is my code that is not
                      > > > working. I do not understand how you find the autocomplete
                      selected
                      > > > value and set the text box value.
                      > > >
                      > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                      > > >
                      > > >
                      > > > <head>
                      > > > <title>Untitled</title>
                      > > > <!-- Dependencies -->
                      > > > <script src="/includes/yahoo.js"></script>
                      > > > <script src="/includes/dom.js"></script>
                      > > > <script src="/includes/event.js"></script>
                      > > > <!-- OPTIONAL: Animation (required only if enabling animation) -->
                      > > > <script src="/includes/animation.js"></script>
                      > > > <!-- Source file -->
                      > > > <script src="/includes/autocomplete.js"></script>
                      > > > <style>
                      > > > div#myContainer {z-Index: 10000; position: absolute; top: 50px;
                      left:
                      > > > 564px; padding: 5px; width: 200px; border: 1px Black Solid;
                      > > > background: #cccccc; color: #000000}
                      > > > div#myContainer ul,li {padding:0;margin:0;}
                      > > > li.myClass {background: #ffffff;}
                      > > > </style>
                      > > >
                      > > >
                      > > > </head>
                      > > >
                      > > > <body>
                      > > > <form action="http://intuitsearch.intuit.com/search" method="get"
                      > > > id="searchForm" autocomplete="off"><input value="xml_no_dtd"
                      > > > name="output" type="hidden"><input value="accountant_site"
                      > > > name="client" type="hidden"><input value="accountant_site"
                      > > > name="site" type="hidden"><input value="accountant_site"
                      > > > name="proxystylesheet" type="hidden"><input value="10" name="num"
                      > > > type="hidden"><input name="q" id="q" type="text" class="searchbox"
                      > > > onchange="onItemSelect();">  <input type="image"
                      > > > src="/images/homepage/btn-search.gif" alt="Search" width="70"
                      > > > height="20" border="0"></form>
                      > > > <div id="myContainer"></div>
                      > > > <script>
                      > > >
                      > > > function init () {
                      > > > var myArray = ["QuickBooks Pro", "QuickBooks Premier", "QuickBooks
                      > > > Accountant Edition"];
                      > > > var myDataSource1 = new YAHOO.widget.DS_JSArray(myArray);
                      > > > var autoComplete = new YAHOO.widget.AutoComplete('q','myContainer',
                      > > > myDataSource1);
                      > > > // Use a custom class for LI elements
                      > > > autoComplete.highlightClassName = "myClass";
                      > > > autoComplete.itemSelectEvent.subscribe(onItemSelect);
                      > > > }
                      > > >
                      > > > function onItemSelect(sType, aArgs) {
                      > > > //set the value manually
                      > > > YAHOO.util.Dom.get("q").value =
                      > > > YAHOO.widget.AutoComplete.itemSelectEvent.value();
                      > > > //find the form in the dom and submit it
                      > > > YAHOO.util.Dom.get("searchForm").submit();
                      > > > }
                      > > > YAHOO.util.Event.addListener(window, 'load', init);
                      > > >
                      > > >
                      > > > </script>
                      > > > </body>
                      > > >
                      > >
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.