Erol F. wrote:
<%= submit_tag “Next”,
:onclick => “if($(‘camp’).length - 1 > $(‘camp’).selectedIndex) $
(‘camp’).selectedIndex++; return false;” %>
Thanks Erol F. for the answer… but I just couldn’t make any use
of it coz it doen’t work and I’m using <%=javascript_include_tag
“prototype.js”%>. To make clear what I’m doing here is my code:
VIEW:
Locations
<%= select(:walks, :id, Greatwalk.find_available_locations,
{:prompt=>'Select Great Walk Location'}, :selected => nil, :id
=> :great_walks) %>
<%= observe_field("great_walks", :url => {:controller => "user",
:action => "update_campsites"},
:update => "campsites_list", :with => "id")%>
<%form_for :cart, :url => {:action => :add_to_cart} do |form|%>
Campgrounds
<%= form.select "campsite", %w{ ---- }, :class =>
"select_campsites" %>
Arrival Date:
<%= form.text_field :arrival_date %>
Nights:
<%= form.text_field :nights %>
Parents:
<%= form.text_field :parents %>
Children:
<%= form.text_field :children %>
Family Rate:
<%= form.check_box "family_claim",{}, "1", "0"%>
<%=submit_tag “Calculate”%>
<%end%>
<%= submit_tag “Next”,
:onclick => “if($(‘camp’).length - 1 > $(‘camp’).selectedIndex) $
(‘camp’).selectedIndex++; return false;” %>
PARTIAL:
Campgrounds
<%=select "camp", "id", @resultset %>
================================================================================
As you can see, I will be updating combo box in the partial. Also, what
I want to do is make two buttons inside the form and if I click one it
will change the value of combo box to next and if I click another some
action will be call (add_to_cart in my case).
Thanks again…