Topic: To render rhtml file in form

I have one error_occur_id field in the form as dropdown .when i select error_occur_id as yes i want 1 rhtml file should render partially in the form . for that i make error_occur_id field as observe field  n i have written following code in ajax file.

if params[:incident_detail_error_occur_id]
@eo = ErrorOccur.find(:all, :conditions => ['error_occur_id = ?',params[:'incident_detail_error_occur_id]] )
  page.replace_html  "incident_detail_error_occur_fields", :partial => 'part3b'

and in the form i have written following code,
    <th>Do you want log an error</th>
    <td id="error_occur_id_field"><%= select("incident_detail", "error_occur_id", ErrorOccur.find(:all,:order=>"name").collect {|eo| [, ] }, { :include_blank => true }) %></td>

<% if (params[:action] == 'create' ) && @incident_detail.error_occur_id == '2' %>
<%= render :partial => "part3b", :object => @incident_detail %>
<% end %>

<%= observe_field 'incident_detail_eror_occur_id',
        :url => {:action => :get_erroroccur_details },
        :with => "error_occur_id" %>
but  its not rendering part3b.rhtml file in the form .i don't know what happen, plase help me out.thanks in advance

Re: To render rhtml file in form

Your if condition will always return false, because the params[] value you want to read doesn't exist. The select helper creates a name attribute for the select tag like name="incident_detail[error_occur_id]":

<select name="incident_detail[error_occur_id]" id="incident_detail_error_occur_id">

While the id attribute is used by Javascript to access an element in the DOM of the page, the name attribute is what gives the content a form element its name, and that's what gets into the params hash.
So the params should look like this: