<p>I am using Ruby on Rails.</p>

<p>I want to create a filter field on a page such that whenever the input field's value changes I filter a list shown below via ajax. (Exaclty like the Users search works in Stackoverflow)</p>

<p>For now, I made it run with a form_remote_tag containing a text_field_tag and a submit_tag, and it filters my list when I push the submit button. I would like to remove the submit button and execute the filtering every time the value of the text input changes. How can I trigger a form submit every time the text in an input field changes?</p>

<p>I tried inside my form</p>

<p><code>&lt;%= text_field_tag (:filter), "" , :onchange =&gt; "alert ('This is a Javascript Alert')" %&gt;</code></p>

<p>just to get the onchange event, but somehow not even this alert appears...</p>

Use
observe_field
helper with a single input, like the code bellow:
```
```
<%= text_field_tag 'filter' %>
<%= observe_field 'filter', 
    :url => {:controller => 'your_controller', :action => 'filter'},
    :frequency => 1.2,
    :update => 'results',
    :with => "'typed_filter=' + $('filter').value" %>
```
```
And then just write a controller that, given a param named 'typed_filter', renders the results, wich will be shown in the element with id 'results' (probably a div).