Skip to content
Browse files

Avoid duplicating your options when you have priority countries.

Otherwise you can end up with multiple selected options which causes invalid html code
  • Loading branch information...
1 parent 99b494e commit 3e7ead2a14969a4eaa79891f1fd994599bcf74ac @donaldpiret donaldpiret committed with karmi Aug 4, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/localized_country_select.rb
View
4 lib/localized_country_select.rb
@@ -67,8 +67,10 @@ def localized_country_options_for_select(selected = nil, priority_countries = ni
if priority_countries
country_options += options_for_select(LocalizedCountrySelect::priority_countries_array(priority_countries), selected)
country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
+ return country_options + options_for_select(LocalizedCountrySelect::localized_countries_array - LocalizedCountrySelect::priority_countries_array(priority_countries), selected)
+ else
+ return country_options + options_for_select(LocalizedCountrySelect::localized_countries_array, selected)
end
- return country_options + options_for_select(LocalizedCountrySelect::localized_countries_array, selected)
end
end

0 comments on commit 3e7ead2

Please sign in to comment.
Something went wrong with that request. Please try again.