I have an observe field for a select field.

 <p>
    <%= f.label :type_id%><br />
    <%= f.select :type_id,RuleType.all.collect{|c| [c.description,c.id]}
%>
    <!-- on change or on select show drop down for value otherwise
regular value -->
  </p>
    <p>
  <%= observe_field 'type_id', :url => { :controller =>
'rule_type', :action => 'List' }, :update => 'List',
:with => 'id=+value' %>
</p>

I created a partial that based on the selected value of type id will
either create another select or a text field.


<%= if @ruleListType == 5 >
  <p>
   <%= f.label :locationList  %>
    <%= f.select :locationList ,Location.get_locations.all.collect{|c|
[c.description,c.location_id]} %>
  </p>
<%=else %>
<p>
    <%= f.label :value %>
    <%= f.text_field :value %>
</p>

<%=end %>

I thought i can render the partial in the first view.
Because I have an observe field I need to create a method caleld List
that will be called. In this method I can check id ==5 then render a
partial that has the locationList if not render a different partial that
is just a text field.

1. How do I write the code for the controller?
2. If I render from the controller where on the view are these fields?
Right after the first select bec the obeserve field is there? I want it
somewhere else is there a way to do this?

Thank you
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to