Reputation: 4687
I have the following code:
<%= f.label :body, value: 'name'} %>
<div class="message_body_input">
<%= f.input :body, as: :text, input_html: {value: @body_text}, label: false %>
</div>
I need to have the label outside of the div because of my css. The label is appearing properly, but I can't figure out how to change the label text. I've looked through the simple form documentation and it does not cover how to do it when the label is outside of the input field. How would I change the label from saying 'body' to say 'name'?
Upvotes: 0
Views: 2647
Reputation: 38645
Label does not have value
, use label
option as:
<%= f.label :body, label: 'name' %>
#=> <label class="string control-label" for="body"> name</label>
Depending upon your wrapper configuration you might get different classes
and other nested elements.
Upvotes: 3