How do you do ajax drop downs? I was looking over at
http://www.roryhansen.ca/?p=9
but couldn’t get it to work properly. I decided to try and use
form_remote, but it would submit the form instead of preformaing an ajax
call.
Since I need 2 form elemnts to preform an ajax calls, will they need to
be in seperate forms?
controller
test_update
@counties = County.find(:all,
:conditions => [“state = ?”, params[:state_id]])
@html = “<select id=’county_id’ name=’county_id’>â€
@html += “<option value='’>select county</option>â€
@counties.each do |cty|
@html += “<option value=’#{cty.id}’>#{cty.name}</option>â€
end
@html += “</select>â€
end
index
… code to get state array, generate other stuff
end
index.rhtml
…
<form_remote_tag :html => {
url_for{:controller => “locator”, action => test_update) } %>
State
County
City
… the next form