You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org> on 2007/06/24 15:42:39 UTC

[jira] Updated: (TAPESTRY-1441) Autocompleter autofills textfield with unexpected value

     [ https://issues.apache.org/jira/browse/TAPESTRY-1441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Kuhnert updated TAPESTRY-1441:
------------------------------------

    Fix Version/s:     (was: 4.1.2)
                   4.1.3

> Autocompleter autofills textfield with unexpected value
> -------------------------------------------------------
>
>                 Key: TAPESTRY-1441
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1441
>             Project: Tapestry
>          Issue Type: Bug
>          Components: XHR/dhtml/Ajax
>    Affects Versions: 4.1.2
>         Environment: Tapestry 4.1.2 snapshot from 5-3, WinXP, Firefox 2
>            Reporter: Ben Dotte
>             Fix For: 4.1.3
>
>
> 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);
> 		}
> 	};
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org