Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select element, simple_form helper

I am trying to create an element in my form that uses simple form+bootstrap. The idea is to allow a user select a type of currency from a drop down.

Customer_currency to select from either USD- US Dollars, LRD - Liberian dollar among others.

I have used the following in my form

However, it is not working, all I see is a drop down (out of position) in my form with the options but no label.

How can i create a good select element with a label using simple form

<%= simple_form_for @customer, :html => { :class => 'form-horizontal' } do |f| %>
<%= f.input :name %>
<%= f.select :customer_currency, [['UGX- Uganda Shillings',1],['USD- US Dollars',2]] %>
<%= f.input :payment_terms %>
<%= f.input :billing_address %>
<%= f.input :first_name %>
<%= f.input :last_name %>
<%= f.input :mobile %>
<%= f.input :email %>
<div class="form-actions">
<%= f.button :submit, :class => 'btn-primary' %>
<%= link_to t('.cancel', :default => t("helpers.links.cancel")),
            customers_path, :class => 'btn' %>
</div>
<% end %>
like image 371
zurik Avatar asked Feb 18 '23 12:02

zurik


1 Answers

<%= f.input :customer_currency, :collection => [['UGX- Uganda Shillings',1],['USD- US Dollars',2]] %>
like image 123
zurik Avatar answered Feb 27 '23 18:02

zurik