d135-1r43
d135-1r43

Reputation: 2485

Grouping labels with simple_form

Is it possible to group inputs with simple_form?

I want "Postcode and city" to appear with one label and two inputs in one div as a group and not separately. But I cannot find a switch that turns off the label…

Upvotes: 1

Views: 2147

Answers (2)

Ivan
Ivan

Reputation: 883

@rafaelfranca is right.

I am using Simple Form with an address like this:

<%= f.input :address, :placeholder => "Street + housenumber" %>
<%= f.input :zip, :label => false, :placeholder => "ZIP-code" %>
<%= f.input :locality, :label => false, :placeholder => "City/Town/Locality" %>
<%= f.input :state, :label => false, :placeholder => "State/Area" %>
<%= f.input :country, :label => false, :placeholder => "Country" %>

Then you will get only one label "Address" for the first text field. And all the next fields will show a placeholder.

Upvotes: 1

rafaelfranca
rafaelfranca

Reputation: 3285

You can turn off the label on one input with the :label => false option.

Like this:

<%= f.input :name, :label => false %>

Upvotes: 3

Related Questions