Hi, I'm learning ruby on rails at the moment so please consider if this
is a silly problem. I have a index.rhtml file where the combo box lies.
When this combo box with different areas changes it updates another
combo box within the same file and displays all the campsites in that
area. For this I've written:

index.rhtml
--------------------------------------------------------------------------------
<form>
  <%= select(:selected, :location, GreatWalk.getAvailableLocations,
{:prompt => 'Select a category'}, :id => :id_selected) %>

  <%= observe_field :id_selected, :url => {:action =>
:update_campsites}, :update => :campsites, :with => "walk_id" %>
</form>
<%form_for :booking, :url => {:action => :save_bookings} do |form|%>
  <div id="campsites">
    <%=form.select "camp_id", Campsite.getAvailableCamps%>
  </div>
        <%=submit_tag "Get Camp And Save"%>
<%end%>
--------------------------------------------------------------------------------

update_campsites.rhtml
--------------------------------------------------------------------------------
<div id="campsites">
   <%=select "selected", "camp_id", @campholder %>
</div>
--------------------------------------------------------------------------------

The problem is, no way in the world, I could get the selected campsite.
I tried @booking=Booking.new(params[:booking]) and then (print
@booking.camp_id) in the save_bookings action in the controller, it
shows nil. I also tried putting @camp=params["selected"]["camp_id"] and
then (print @camp )in update_campsites action in controller but gives
error instead. Also after I click the button and change the first combo
box value it doesn't trigger any update to the second combo box. So,
please help me find what I'm doing wrong here and how I can get that
selected value, that would be so great. thanks

regards,
Jay
-- 
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