Continent Country select (demo page)
This is a small JavaScript file which can transform a select box in a country selector field accordly to the continent selected, very similar to the cidades-estados javascript file (actually, this is a fork) of that file.
In order to use this plugin, you need to add the following above:
= f.input :continent, required: true
= f.input :country, as: :string, required: true
NOTE: See this as: :string
up? this is to resolve conflicts with country_select
gem.
<script type="text/javascript">
$(function() {
new dgContinentsCountries({
continentVal: document.getElementById("[model]_continent").val,
countryVal: document.getElementById("[model]_country").val,
continent: document.getElementById("[model]_continent"),
country: document.getElementById("[model]_country"),
change: true
});
});
</script>
<script type="text/javascript">
Event.observe(window, 'load', function() {
new dgContinentsCountries({
continent: $('[model]_continent'),
country: $('[model]_country')
});
});
<script>
It's simple!
The credits go mainly for the creators of the first plugin 'cidades-estados' Roberto && Michael
Need files with the name of all countries and their cities? Here we are!