# observe\_field to update render partial in a div

**URL:** <https://discuss.rubyonrails.org/t/observe-field-to-update-render-partial-in-a-div/22956>\
**Category:** rubyonrails-talk\
**Created:** [January 10, 2008, 8:43am UTC](https://discuss.rubyonrails.org/t/observe-field-to-update-render-partial-in-a-div/22956 "2008-01-10T08:43:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [January 10, 2008, 8:43am UTC](https://discuss.rubyonrails.org/t/observe-field-to-update-render-partial-in-a-div/22956/1 "2008-01-10T08:43:24Z")

</div>

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%"\> &nbsp;&nbsp;\<%= 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", &nbsp;&nbsp;&nbsp;:update =\> "create\_ci\_container", &nbsp;&nbsp;&nbsp;:url =\> { :controller =\> :create\_ci, :action =\> :create\_ci }, &nbsp;&nbsp;&nbsp;:method =\> "post", &nbsp;&nbsp;&nbsp;: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
