Reputation: 5203
This line is in one of my forms:
<%= question.answer %><%= f.text_field :answer, :placeholder => "Respond..." %>
It displays the answer to a question and shows a text field to update that answer.
The only problem is that the place holder text is never shown and the content is always set to the answer content rather than "Respond..." as a placeholder.
Upvotes: 1
Views: 2904
Reputation: 5203
<%= question.answer %><%= f.text_field :answer, :value => "", :placeholder => "Respond..." %>
Does the trick it seems, this is a modified version of @Yogzzz's answer - he should get credit. He hasn't made the changes to his answer so I can't accept it as correct.
Upvotes: 2
Reputation: 2795
Try this:
<%= question.answer %><%= f.text_field :answer, '', :placeholder => "Respond..." %>
You were setting your placeholder as the value parameter: text_field_tag(name, value = nil, options = {})
http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-text_field_tag
Upvotes: 5