You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leon Derks <le...@cumquat.nl> on 2008/04/29 13:47:50 UTC

Autocomplete mixin + select event

Does the autocomplete mixin fire some kind of event, after I have 
selected an item from the autocomplete-menu?

Because I want to update other fields, based on the value that I selected.

How can I do this?


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


Re: Autocomplete mixin + select event

Posted by Leon Derks <le...@cumquat.nl>.
Thanks for the tips!

Leon

Steven Woolley wrote:
> I've got it working by overriding the Autocomplete mixin and putting 
> the following in the AfterRender (instead of using a json object).
>
> String configS = "{indicator:'" + loaderId + "',frequency:.5,minChars:"
>                 + minChars
>                 + ",paramName:\"t:input\",afterUpdateElement:onChosen}";
>
>         _pageRenderSupport.addScript(
>                 "new Ajax.Autocompleter('%s', '%s', '%s', %s);", id, 
> menuId,
>                 link.toURI(), configS);
>
> Basically, in am just using a String instead of a JSON object to write 
> out the autocomplete parameters... so I can do the quoting as I 
> desire.  There is a JIRA for the quoting issue already, and hopefully 
> when it's fixed I can go back to using the default implementation.
> Hope that helps.
> Steve
>
> On Apr 29, 2008, at 12:21:31, Josh Canfield wrote:
>
>> In 5.0.11 I was unable to find a good extension point for the
>> autocomplete mixin. The scriptaculous Ajax.Autocompleter does support
>> updateElement and afterUpdateElement methods, but as far as I can tell
>> you can't get them into the configuration because the JSONObject
>> quotes its attributes (making the function into a string). If anyone
>> has solved that problem I'd love to hear about it.
>> http://wiki.script.aculo.us/scriptaculous/show/Ajax.Autocompleter
>>
>> One option would be to add a change handler to the input field that
>> the autocomplete is populating. Something like:
>> $('mytextfield').observe('change', function(theEvent) { /* update
>> other fields */});
>>
>> Hope that helps,
>> Josh
>>
>> On Tue, Apr 29, 2008 at 4:47 AM, Leon Derks <le...@cumquat.nl> 
>> wrote:
>>> Does the autocomplete mixin fire some kind of event, after I have 
>>> selected
>>> an item from the autocomplete-menu?
>>>
>>> Because I want to update other fields, based on the value that I 
>>> selected.
>>>
>>> How can I do this?
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> -- 
>> -- 
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>


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


Re: Autocomplete mixin + select event

Posted by Steven Woolley <wo...@gmail.com>.
I've got it working by overriding the Autocomplete mixin and putting  
the following in the AfterRender (instead of using a json object).

String configS = "{indicator:'" + loaderId + "',frequency:.5,minChars:"
				+ minChars
				+ ",paramName:\"t:input\",afterUpdateElement:onChosen}";

		_pageRenderSupport.addScript(
				"new Ajax.Autocompleter('%s', '%s', '%s', %s);", id, menuId,
				link.toURI(), configS);

Basically, in am just using a String instead of a JSON object to  
write out the autocomplete parameters... so I can do the quoting as I  
desire.  There is a JIRA for the quoting issue already, and hopefully  
when it's fixed I can go back to using the default implementation.
Hope that helps.
Steve

On Apr 29, 2008, at 12:21:31, Josh Canfield wrote:

> In 5.0.11 I was unable to find a good extension point for the
> autocomplete mixin. The scriptaculous Ajax.Autocompleter does support
> updateElement and afterUpdateElement methods, but as far as I can tell
> you can't get them into the configuration because the JSONObject
> quotes its attributes (making the function into a string). If anyone
> has solved that problem I'd love to hear about it.
> http://wiki.script.aculo.us/scriptaculous/show/Ajax.Autocompleter
>
> One option would be to add a change handler to the input field that
> the autocomplete is populating. Something like:
> $('mytextfield').observe('change', function(theEvent) { /* update
> other fields */});
>
> Hope that helps,
> Josh
>
> On Tue, Apr 29, 2008 at 4:47 AM, Leon Derks <le...@cumquat.nl>  
> wrote:
>> Does the autocomplete mixin fire some kind of event, after I have  
>> selected
>> an item from the autocomplete-menu?
>>
>> Because I want to update other fields, based on the value that I  
>> selected.
>>
>> How can I do this?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: Autocomplete mixin + select event

Posted by Josh Canfield <jo...@thedailytube.com>.
In 5.0.11 I was unable to find a good extension point for the
autocomplete mixin. The scriptaculous Ajax.Autocompleter does support
updateElement and afterUpdateElement methods, but as far as I can tell
you can't get them into the configuration because the JSONObject
quotes its attributes (making the function into a string). If anyone
has solved that problem I'd love to hear about it.
http://wiki.script.aculo.us/scriptaculous/show/Ajax.Autocompleter

One option would be to add a change handler to the input field that
the autocomplete is populating. Something like:
$('mytextfield').observe('change', function(theEvent) { /* update
other fields */});

Hope that helps,
Josh

On Tue, Apr 29, 2008 at 4:47 AM, Leon Derks <le...@cumquat.nl> wrote:
> Does the autocomplete mixin fire some kind of event, after I have selected
> an item from the autocomplete-menu?
>
> Because I want to update other fields, based on the value that I selected.
>
> How can I do this?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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