arvindvyas / Country-State-Select

It will fetch the countries and according to that fetch the state of that countries, currently it is for countries listing
MIT License
69 stars 78 forks source link

on changing country states don't load #56

Closed Faisal-nfl closed 5 years ago

Faisal-nfl commented 6 years ago

I added in registration.js (according to my layout)

//= require chosen-jquery
//= require country_state_select

in registration.css @import "chosen";

in form

= f.input :country_field, collection: CountryStateSelect.countries_collection
- options = { form: f, field_names: { :country => :country_field, :state => :state_field } }
= f.input :state_field, CountryStateSelect.state_options(options)

in js at end of from

= content_for :javascript
  javascript:
    $(document).on('ready page:load', function() {
      return CountryStateSelect({
        country_id: "country_field_id",
        state_id: "state_field_id"
      });
    });

States load first time but on changing country states remain same (which loaded first time) Did I miss something?

arvindvyas commented 5 years ago

@Faisal-nfl you can check the dummy app inside it