# Text\_field\_with\_auto\_complete onselect

**URL:** <https://www.ruby-forum.com/t/text-field-with-auto-complete-onselect/103949>\
**Category:** Rails\
**Created:** [May 11, 2007, 9:12pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-onselect/103949 "2007-05-11T21:12:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cfingerh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f14d63/32.png) [@cfingerh](https://www.ruby-forum.com/u/cfingerh)\
**Post date:** [May 11, 2007, 9:12pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-onselect/103949/1 "2007-05-11T21:12:16Z")

</div>

I’m trying to use a autocomplete text field like the one showed in  
scriptaculous

[http://demo.script.aculo.us/ajax/autocompleter\_customized](http://demo.script.aculo.us/ajax/autocompleter_customized)

It works. But I want to call a javascript function just afterwards the  
users selects one name.

Is there any  
onselect=\>‘do\_something()’  
to use with text\_field\_with\_auto\_complete ?

Thanks

Christian

---

<div class="post-metadata">

**Author:** ![cfingerh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f14d63/32.png) [@cfingerh](https://www.ruby-forum.com/u/cfingerh)\
**Post date:** [May 11, 2007, 9:51pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-onselect/103949/2 "2007-05-11T21:51:23Z")

</div>

On May 11, 2007, at 9:11 PM, cfingerh wrote:

> ```
> onselect=>'do_something()'
> 
> ```
> 
> to use with text\_field\_with\_auto\_complete ?

Yes, there’s:

:after\_update\_element =\> “function (e, v) { … }”

The first argument of the JavaScript function is the textfield  
element and so e.value holds the selection, v is the corresponding  
list item.

– fxn
