Skip to content

Commit

Permalink
prevent selected= from being included in the HTML twice, making it ha…
Browse files Browse the repository at this point in the history
…rder to choose between priority countries in some browsers

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information
joshgoebel authored and NZKoz committed Oct 28, 2010
1 parent d3b5d86 commit f6b49db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/country_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def country_options_for_select(selected = nil, priority_countries = nil)
if priority_countries
country_options += options_for_select(priority_countries, selected)
country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
# prevents selected from being included twice in the HTML which causes
# some browsers to select the second selected option (not priority)
# which makes it harder to select an alternative priority country
selected=nil if priority_countries.include?(selected)
end

return country_options + options_for_select(COUNTRIES, selected)
Expand Down

0 comments on commit f6b49db

Please sign in to comment.