Created
May 5, 2011 22:34
-
-
Save rangerscience/958117 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= form_for @office, :remote => true do |f| | |
-if @office.errors.any? | |
#error_explanation | |
%h2= "#{pluralize(@office.errors.count, "error")} prohibited this office from being saved:" | |
%ul | |
- @office.errors.full_messages.each do |msg| | |
%li= msg | |
.field | |
= f.label :title | |
= f.text_field :title | |
.field | |
= f.label "state_id" | |
= collection_select(:state, :state_id, State.all, :id, :name) | |
.field | |
= f.label "county_id" | |
= collection_select(:county, :county_id, State.all, :id, :name) | |
.field | |
= f.label "city_id" | |
= collection_select(:city, :city_id, City.all, :id, :name) | |
.actions | |
= f.submit 'Save' | |
:javascript | |
jQuery(function(){ | |
$("#state_state_id").change(function() { | |
$.post(<%= get_counties_url(:id => state.id) %>, function(data) | |
{ $.("city_city_id").html(data); | |
}); | |
}); | |
}); |
krainboltgreene
commented
May 5, 2011
def get_counties
logger.info 'id:' + params[:id]
# @counties = County.find_by_place_id(params[:id])
# render :inline => "= collection_select(:county, :county_id, @counties, :id, :name)", :content_type => "haml"
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment