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

Re: Enter Key with Auto Complete

Expand Messages
  • jennykhan
    Hi Jim, What about hooking into the itemSelectEvent to submit the form? Something like myAutoComp.itemSelectEvent.subscribe(myHandler); var myHandler =
    Message 1 of 4 , Aug 1, 2006
    • 0 Attachment
      Hi Jim,

      What about hooking into the itemSelectEvent to submit the form?
      Something like

      myAutoComp.itemSelectEvent.subscribe(myHandler);

      var myHandler = function(){
      myForm.submit();
      }

      Jenny

      --- In ydn-javascript@yahoogroups.com, "THECREW" <jim@...> wrote:
      >
      > I would like to enable the enter key so that once a selection has been
      > made that the form can be submitted and not have to use the submit
      > button. Any help on where this has been disabled would be great.
      >
      > Thanks
      > Jim
      >
    • Jim Baumann
      Jenny, If I add the form.submit() before oAutoComp.itemSelectEvent.subscribe(myHandler); then it submits with out filling in the secondary field if I put it
      Message 2 of 4 , Aug 1, 2006
      • 0 Attachment
        Jenny,

        If I add the form.submit() before
        oAutoComp.itemSelectEvent.subscribe(myHandler);
        then it submits with out filling in the secondary field if I put it after
        it goes into a loop. Any Idea of what I can do here.

        Thanks

        oACDS = new YAHOO.widget.DS_XHR("requests.php", ["ResultSet.Result",
        "firstName", "lastName"]);
        oACDS.queryMatchContains = true;
        oACDS.scriptQueryAppend = "output=json&do=actionname"; // Needed for YWS

        // Instantiate auto complete
        oAutoComp = new YAHOO.widget.AutoComplete("FormFieldName","DivName",
        oACDS' . $widget . ');
        oAutoComp.maxResultsDisplayed = 200; // Display up to 20 results in the
        container
        oAutoComp.forceSelection = true; // Enable force selection
        oAutoComp.queryDelay = 0; // Every key
        input event will trigger an immediate query...

        // Format results since we are returning more then the first element in
        the array
        oAutoComp.formatResult = function(oResultItem, sQuery) {
        // This was defined by the schema array of the data source
        var sFirstName = oResultItem[0];
        var sMarkup = sFirstName;
        return (sMarkup);


        var myHandler = function(type, args, me) {
        var oAutoComp = args[0]; // the autocomplete instance
        var elListItem = args[1]; // the result list item element
        var keyData = args[2][0]; // result data [0]
        var moredata = args[2][2]; // result data [1]

        document.getElementById("DivName").value = moredata; // Set data into
        employeeID form field
        }
        oAutoComp.itemSelectEvent.subscribe(myHandler);


        > Hi Jim,
        >
        > What about hooking into the itemSelectEvent to submit the form?
        > Something like
        >
        > myAutoComp.itemSelectEvent.subscribe(myHandler);
        >
        > var myHandler = function(){
        > myForm.submit();
        > }
        >
        > Jenny
        >
        > --- In ydn-javascript@yahoogroups.com, "THECREW" <jim@...> wrote:
        >>
        >> I would like to enable the enter key so that once a selection has been
        >> made that the form can be submitted and not have to use the submit
        >> button. Any help on where this has been disabled would be great.
        >>
        >> Thanks
        >> Jim
        >>
        >
        >
        >
        >
        >


        --
        Jim Baumann
        PoorMansWeb
        775.771.0498
      • jennykhan
        Hi Jim, Sorry, I don t quite follow. Is this causing an infinite loop for you? I don t see where you are calling submit() on the form. If you continue to have
        Message 3 of 4 , Aug 1, 2006
        • 0 Attachment
          Hi Jim,

          Sorry, I don't quite follow. Is this causing an infinite loop for you?
          I don't see where you are calling submit() on the form. If you
          continue to have this problem, can you paste the entire HTML into a
          message (or even better, send us a link), and be sure to mention what
          browser and OS you're on.

          Thanks!
          jenny




          var myHandler = function(type, args, me) {
          var oAutoComp = args[0]; // the autocomplete instance
          var elListItem = args[1]; // the result list item element
          var keyData = args[2][0]; // result data [0]
          var moredata = args[2][2]; // result data [1]

          document.getElementById("DivName").value = moredata; // Set data into
          employeeID form field

          myForm.submit();
          }

          oAutoComp.itemSelectEvent.subscribe(myHandler);




          --- In ydn-javascript@yahoogroups.com, "Jim Baumann" <jim@...> wrote:
          >
          > Jenny,
          >
          > If I add the form.submit() before
          > oAutoComp.itemSelectEvent.subscribe(myHandler);
          > then it submits with out filling in the secondary field if I put it
          after
          > it goes into a loop. Any Idea of what I can do here.
          >
          > Thanks
          >
          > oACDS = new YAHOO.widget.DS_XHR("requests.php", ["ResultSet.Result",
          > "firstName", "lastName"]);
          > oACDS.queryMatchContains = true;
          > oACDS.scriptQueryAppend = "output=json&do=actionname"; // Needed
          for YWS
          >
          > // Instantiate auto complete
          > oAutoComp = new YAHOO.widget.AutoComplete("FormFieldName","DivName",
          > oACDS' . $widget . ');
          > oAutoComp.maxResultsDisplayed = 200; // Display up to 20 results in the
          > container
          > oAutoComp.forceSelection = true; // Enable force selection
          > oAutoComp.queryDelay = 0; // Every key
          > input event will trigger an immediate query...
          >
          > // Format results since we are returning more then the first element in
          > the array
          > oAutoComp.formatResult = function(oResultItem, sQuery) {
          > // This was defined by the schema array of the data source
          > var sFirstName = oResultItem[0];
          > var sMarkup = sFirstName;
          > return (sMarkup);
          >
          >
          > var myHandler = function(type, args, me) {
          > var oAutoComp = args[0]; // the autocomplete instance
          > var elListItem = args[1]; // the result list item element
          > var keyData = args[2][0]; // result data [0]
          > var moredata = args[2][2]; // result data [1]
          >
          > document.getElementById("DivName").value = moredata; // Set data into
          > employeeID form field
          > }
          > oAutoComp.itemSelectEvent.subscribe(myHandler);
          >
          >
          > > Hi Jim,
          > >
          > > What about hooking into the itemSelectEvent to submit the form?
          > > Something like
          > >
          > > myAutoComp.itemSelectEvent.subscribe(myHandler);
          > >
          > > var myHandler = function(){
          > > myForm.submit();
          > > }
          > >
          > > Jenny
          > >
          > > --- In ydn-javascript@yahoogroups.com, "THECREW" <jim@> wrote:
          > >>
          > >> I would like to enable the enter key so that once a selection has
          been
          > >> made that the form can be submitted and not have to use the submit
          > >> button. Any help on where this has been disabled would be great.
          > >>
          > >> Thanks
          > >> Jim
          > >>
          > >
          > >
          > >
          > >
          > >
          >
          >
          > --
          > Jim Baumann
          > PoorMansWeb
          > 775.771.0498
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.