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

JavaScript: CountryStateSelect is not defined #31

Closed loganh0522 closed 8 years ago

loganh0522 commented 8 years ago

Hello, I would like to start by saying thank you for developing a gem with this functionality. I have followed the process to integrate your Gem, however, my app does not recognize the CountryStateSelect function in JavaScript.

I could not find much documentation, any help resolving this issue would be appreciated.

variousred commented 8 years ago

Getting this as well. Whats your recommended way of loading up the vendor/assets script file?

variousred commented 8 years ago

@loganh0522 , for the meantime i've done this

<%= javascript_include_tag "country_state_select" %>
<%= javascript_tag do %>
$(document).on('ready page:load', function() {
  return CountryStateSelect({
    country_id: "country",
    state_id: "state"
  });
});
loganh0522 commented 8 years ago

@variousred Thanks for that, Ill try that out! Where did you put the<%= javascript_tag do %> in your form for it to send CountryStateSelect to your country_state_select?

variousred commented 8 years ago

@loganh0522 anywhere, really. I had it at the top of my form partial file.

arvindvyas commented 8 years ago

@loganh0522 if you have seen gem then if you will go inside test/dummy there is demo app in which you can see how this application is working, let me know if you still have problem?