Hey all,
I''m trying to update a div everytime the value of my drop down box is
changed:
<tr>
<th width="25%"><label for="ci_citype"
>Type</label></th>
<td width="25%">
<%= select("ci", "citype",
CiType.find(:all).collect{|p| [
p.name,p.id]})%>
</td>
</tr>
<div id="create_ci_container">
<%= render :partial=>''cipart/create_hardware_cis'' %>
</div>
<%= observe_field("ci_citype",
:update => "create_ci_container",
:url => { :controller => :create_ci, :action => :create_ci },
:method => "post",
:with => "''citype_id=''+value") %>
The above code is written in view create_ui.rhtml of ci_controller.
The content in create_ci_controller:
class CreateCiController < ApplicationController
layout nil
def create_ci
@ci_type_id = @params["citype_id"]
end
end
The content in create_ci.rhtml is:
<% if @ci_type_id == ''2'' %>
<%= render :partial=>''cipart/create_software_cis'' %>
<% else %>
<%= render :partial=>''cipart/create_document_cis'' %>
<% end %>
When I first load the page it renders cipart/create_hardware_cis in the
div create_ci_container. The problem is when I change the value of the
drop down box, the corresponding partial file is displayed and then the
entire page disappeared immediately.
Please help me to solve this.
Regards
Suneeta
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---