Hi-
I’m trying to implement the elusive country-state connected select
boxes.
I have a controller:
…
def get_states
@states = State.find(:all, :conditions => {:country_id => 1})
render :partial => “state_options”
end
(this is the ajax call)
and a template:
<% form_for :user, @user, :url => { :action => “create” } do |form| %>
<%= render :partial => ‘form’, :locals => { :form => form, :genders
=> @genders} %>
<%= submit_tag “Create” %>
<%end%>
<%= observe_field(“user_country”, :url => {:action
=> :get_states,:update => “mydiv”}) %>
<%end%>
and a partial, which simply generates the tags in
between the tags.
the first time it’s rendered, it creates an empty pair:
…
State
If I enter the partial URL directly into the browser, it works. If I
replace the observe_field target with a simple alert javascript
function, it works, so I know the syntax and partial are correct. The
problem is, it just won’t update the web browser page. I never see
any change.
Any ideas why?
Thanks,
Dino