Article:
 |
|
Ajax on Rails
|
| Subject: |
|
correct code |
| Date: |
|
2006-04-19 03:02:21 |
| From: |
|
gvlx
|
|
|
|
Hi!
Checking for "observe_field" in http://api.rubyonrails.org/ gave me the answer.
If you use the following test code in the controller
def live_search
render_text "
"+ params.inspect + ". "
end
I'll see the function 'observe_field' will not return the text unless told to do so (you were probably expected to retrive the field directly through the DOM).
change the rhtml to:
<label for="searchtext">Live Search:</label>
<%= text_field_tag :searchtext %>
<%= observe_field(:searchtext,
:frequency => 0.25,
:update => :search_hits,
:with => "searchtext",
:url => { :action => :live_search }) %>
Search Results:
<div id="search_hits"></div>
That will do it (until I learn to fetch the fields directly).
Best Regards
G.
|
Showing messages 1 through 1 of 1.
-
correct code
2006-04-19 03:06:29
gvlx
[View]