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

Autocomplete, enter key submits form

Expand Messages
  • magnus.edevag
    Hi. I have a question regarding strange behaviour for our autocomplete field. I don t think it is the same as Bug in new 2.3.1 AutoComplete enter key behavior
    Message 1 of 1 , Jan 3, 2008
    • 0 Attachment
      Hi. I have a question regarding strange behaviour for our autocomplete
      field. I don't think it is the same as "Bug in new 2.3.1 AutoComplete
      enter key behavior on Mac ", since our problem occurs on FF on
      Wondows, and is alittle bit different.

      When we fill something in our autocomplete field, we get some
      suggestions. If one of these are highligted and we press the enter
      key, everything works as it should (the above form is not submited).
      But, if we have not entered anything in the textfield and press enter
      (then there is no drop-down box with suggestions), the above form is
      submited. This is not the behaviour we want. Is this something that
      can be configured, or is it a bug? We use yui 2.3.1.

      For "YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown" I found
      the following code:

      case 13: // enter
      if(oSelf._oCurItem) {
      if(oSelf._nKeyCode != nKeyCode) {
      if(oSelf._bContainerOpen) {
      YAHOO.util.Event.stopEvent(v);
      }
      }
      oSelf._selectItem(oSelf._oCurItem);
      }
      else {
      /** HERE I TESTED WITH NEW LINE */
      oSelf._toggleContainer(false);
      }
      break;


      Where the comment /** HERE I TESTED WITH NEW LINE */ is, I tested to
      place a line of code like the following:
      YAHOO.util.Event.stopEvent(v);
      Then it did not post when hitting enter on the empty textfield. But
      this, I think, it not a very valid solution.

      So, any ideas how to fix our problem?

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