Forum: Ruby on Rails Checkbox to dropdown list

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Lee M. (Guest)
on 2009-06-07 02:28
Hello everybody

I'm new here. Looking for a bit of help.

I have a long list with radio buttons generated by the attached code. I
need to change this from radio buttons to 2 drop down boxes. One for the
Add-On name and one for the billing cycle. To see the page in action
Click Here.

Hope somebody can give me some pointers.

Many Thanks

Lee

Here is the code:

[code]<%= user_menu %>
<div id='t-add-ons'>
<h2>Add-ons</h2>
<p>We offer some additional services to improve your web site or hosting
experience. Please select any you'd like to order below.</p>

<form accept-charset='utf-8' method='post' action='basket'>
<% if no_upsell? %><input type='hidden' name='no-upsell' value='1'/><%
end %>
<input type='hidden' name='default-product'
value='#:dflt:base_renewal_period,quoted_unit_price'/>
<input type='hidden' name='base_renewal_period-dflt' value='never'/>
<input type='hidden' name='quoted_unit_price-dflt' value='0'/>
<% i = 0 %>
<% addon_products.each do | product | %>
<h4><%= product.name.html %></h4>
<p><%= product.description %></p>
<input type='hidden' name='base_renewal_period-<%= i %>' value="<%=
product.base_renewal_period %>" />
<input type='hidden' name='quoted_unit_price-<%= i %>' value="<%=
billing.price(product.unit_price) %>" />
<% if product.linkable? %>
<p>Link to:
<%= product.link_select(i, linkable_domains, package_linked_domains)
%></p>
<% end %>
<% if product.link_error==:no_domains %>
<p class='error'>You have no domain names available to attach this to.
Please <a href='dac'>order one</a> if you wish to purchase this
item.</p>
<% elsif product.link_error==:no_packages %>
<p class='error'>You have no packages available to attach this to.
Please <a href='package-chooser'>order one</a> if you wish to purchase
this item.</p>
<% elsif product.link_error %>
<p>Purchasing this add-on is not currently possible. Please try again
later.</p>
<% end %>
<p><input <% if product.link_error %>disabled='disabled' <% end
%>type='checkbox' name='add-product' value='<%=
product.specific_type.html %>:<%= i
%>:base_renewal_period,quoted_unit_price,link_to' /><%=
billing.currency_symbol.html %><%= billing.price(product.unit_price,
:use_tax_prefs) %>
<% if product.base_renewal_period != 'never' %>
every <%= product.unit_period.to_s_short.html %>
<% end %>
<% if product.setup_fee != 0 %>
plus a one off fee of <%= billing.currency_symbol.html %><%=
sprintf("%.2f", if billing.include_tax? then
billing.price(product.setup_fee) else product.setup_fee end) %>
<% end %>
*
</p>
<% i = i + 1 %>
<% end %>
<p><input type='submit' value='Add to Basket'/></p>
</form>
<% unless basket.nil? or basket.empty? or no_upsell? %>
<p><a href='basket?add-no-product=add-on'>No thank you, please continue
with my order ....</a></p>
<% end %>
<% if not billing.tax_applies? %>
<% elsif billing.include_tax? %>
  <p>* Includes <%= billing.tax_name %></p>
<% else %>
  <p>* Excluding <%= billing.tax_name %></p>
<% end %>
</div>
[/code]
This topic is locked and can not be replied to.