How to refresh a web page when a user selects a specific value in a drop-down list on rails?

I am developing a project on rails 2.3.8, and I need to refresh the entire web page when the user selects a specific choice from the drop-down menu. How can I do this on rails?

This is my drop down menu.

<%= collection_select("country", "id", @countries , :id, :name, {:prompt => true}, :id => 'xx') %> <%= observe_field('xx', :url => { :controller => 'calendar', :action => 'update_country' },:update => 'app_header',:with => "'con=' + escape(value)")%> 

This definitely loads countries, so how can I reload the whole page? please can someone explain me about this?

+4
source share
1 answer

Just add the html parameter to your collection, select onchange => "Javascript code to reload the page"

 <%= collection_select("country", "id", @countries , :id, :name, {:prompt => true}, :id => 'xx', :onchange => "location.href = '#{root_url}'") %> 
+3
source

All Articles