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

        Hide
        Andreas Andreou added a comment -

        Arent you using the scriptaculous autocompleter now? Anyway, dojo's seems indeed broken with that regard.

        Best thing that can be done is allow setting their autoComplete parameter to false - so that the textfield doesn't get
        autocompleted

        Show
        Andreas Andreou added a comment - Arent you using the scriptaculous autocompleter now? Anyway, dojo's seems indeed broken with that regard. Best thing that can be done is allow setting their autoComplete parameter to false - so that the textfield doesn't get autocompleted
        Hide
        Ben Dotte added a comment -

        Yes, we use the scriptaculous autocompleter exclusively now. This bug was reported before the scriptaculous version existed, so it isn't something we need fixed but yes, it is still a problem with the dojo version for anyone else who might want to use that instead.

        Show
        Ben Dotte added a comment - Yes, we use the scriptaculous autocompleter exclusively now. This bug was reported before the scriptaculous version existed, so it isn't something we need fixed but yes, it is still a problem with the dojo version for anyone else who might want to use that instead.
        Hide
        Andreas Andreou added a comment -

        New parameter added and documented.

        Show
        Andreas Andreou added a comment - New parameter added and documented.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development