the div list of words doesn''t get updated
# controller
class Words < R ''/words''
def get
("word01".."word20").each{|w| (@words
||='''') << "<li>#{w}</li>"}
render :_list
@words
end
end
#views
#
def layout
html do
head do
link :rel => ''stylesheet'', :type =>
''text/css'', :href =>
''/static/style.css'', :media => ''all''
[''prototype'', ''effects'',
''controls'',''search''].each do |s|
script :src => "/static/#{s}.js", :type =>
''text/javascript''
end
#...
end
end
end
def _links
@words
end
def search
#...
form({:method=>''GET''}.merge(options)) do
p do
input.search :id=>''search'',
:type=>''text'', :name=>''search''
end
div.search(:id=>''results'',
:style=>"display: block;") do
p "Results:"
_links
end
input :type=>''submit'',
:value=>''search''
#...
end
#here''s the search.js got this off a werbrick sample...
# http://www.jhl.it/Courses/LUGPC7.html
document.observe(''dom:loaded'', function() {
new Ajax.Autocompleter(''search'',
''results'', ''/words'', {
method: ''get'',
minChars: 2,
updateElement: function(item) { /* no update */ }
});
});
sample code in camping would be very helpful.
thanks!