Tapestry
  1. Tapestry
  2. TAPESTRY-1441

Autocompleter autofills textfield with unexpected value

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.5
    • Component/s: XHR/dhtml/Ajax
    • Labels:
      None
    • Environment:
      Tapestry 4.1.2 snapshot from 5-3, WinXP, Firefox 2

      Description

      After you begin typing into an Autocompleter, the dropdown appears with possible values and the textfield attempts to autofill itself. I would assume it is supposed to autofill with the first available value. The problem is the text it tries to autofill with is not right if the possible values don't start with the value entered by the user (a contains search).

      As an example, say I have an autocompleter with the values "01 blah", "02 blah", "03 blah", "04 blah", and "05 blah". I type "bla" into the textfield and wait for the dropdown to appear. When the dropdown appears, all of the possible values appear as expected, but the textfield now says "blablah". I would not expect "blah" to get appended to the "bla" I typed in as this is not a valid choice.

      Either the textfield should autofill with a valid value, or it shouldn't autofill at all, like the Tacos autocompleter. (I would prefer the latter.)

      Here is some code to replicate the example:

      .html:
      <form jwcid="@Form">
      <span jwcid="autocompleteTest@Autocompleter" value="ognl:curValue" model="ognl:model" />
      </form>

      .java:
      public abstract String getCurValue();

      public IAutocompleteModel getModel()
      {
      final List<String> values = Arrays.asList("01 blah", "02 blah", "03 blah", "04 blah", "05 blah");

      return new IAutocompleteModel()
      {
      public String getLabelFor(Object value)

      { return (String) value; }

      public List getValues(String filter)
      {
      List<String> result = new ArrayList<String>();

      for (String val : values)
      {
      if (val.contains(filter))

      { result.add(val); }

      }
      return result;
      }

      public Object getPrimaryKey(Object value)

      { return values.indexOf(value); }

      public Object getValue(Object primaryKey)

      { return values.get((Integer) primaryKey); }

      };
      }

        Activity

        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569149 ] jira [ 12590412 ]
        Mark Thomas made changes -
        Workflow jira [ 12403303 ] Default workflow, editable Closed status [ 12569149 ]
        Andreas Andreou made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Andreas Andreou [ andyhot ]
        Jesse Kuhnert made changes -
        Fix Version/s 4.1.3 [ 12312516 ]
        Fix Version/s 4.1.4 [ 12312763 ]
        Jesse Kuhnert made changes -
        Fix Version/s 4.1.2 [ 12312202 ]
        Fix Version/s 4.1.3 [ 12312516 ]
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Fix Version/s 4.1.2 [ 12312202 ]
        Ben Dotte created issue -

          People

          • Assignee:
            Andreas Andreou
            Reporter:
            Ben Dotte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development