开发者

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…


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

Like this:

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


@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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜