Skip to content

Commit

Permalink
Avoid duplicating your options when you have priority countries.
Browse files Browse the repository at this point in the history
Otherwise you can end up with multiple selected options which causes invalid html code
  • Loading branch information
donaldpiret authored and karmi committed Aug 4, 2010
1 parent 99b494e commit 3e7ead2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/localized_country_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3e7ead2

Please sign in to comment.