I am using this in my controller to reload the country_area partial in
my form
def add_country_area
render :update do |page|
page[:country_area].reload
end
end
<< in form >>
<span id="country_area">
<%= render :partial => ''country_area'' %>
</span>
<< partial _country_area.rhtml >>
<%= select :country_area, :id, @country_areas.collect {|c| [c.descr,
c.id]}, {:prompt => "-- Select Area --"},
{:name => "country_area_select", :onChange => "new
Ajax.Updater(''country_area_info'',
''/controller/admin/change_country_area/''+country_area.selectedIndex,
{asynchronous:true, evalScripts:true});" }
%>
--------
Here is the HTTP response I get back using FireBug:
$("country_area").replace(
"<select id=\"country_area_id\"
name=\"country_area_select\"
onChange=\"new Ajax.Updater(''country_area_info'', \n
\t''/controller/admin/change_country_area/''+country_area.selectedIndex,\n
\t{asynchronous:true, evalScripts:true});\"><option
value=\"2\">Guayanquil</option>\n<option
value=\"7\">New</option>\n
<option value=\"8\"
selected=\"selected\">New</option>\n<option
value=\"1\">Quito</option></select>");
---------
So when the page is redisplayed, it doesn''t evaluate the response, but
instead I get:
$("country_area").replace(| .. drop down list ..|");
Why isn''t the content in my country_area span getting replaced
correctly? Also, I do have the necessary javascript files in my layout,
I know that can be a problem when it does not get evaluated.
Thanks for the help!
Brian
--
Posted via http://www.ruby-forum.com/.