Reputation: 3189
How do I print simple text to be a form value and make it non editable? I am not looking for
<%= text_field_tag :something, nil, :readonly => true %>
I want it without a read only input box. Like html and still get posted via the form.
<a id="something"></a>
Upvotes: 0
Views: 3234
Reputation: 1829
render_field(field, prefix, options.merge(:hide_description => true, :readonly => true))
Where render_field is the following:
# Returns html def render_field(field, prefix = "", options = {}) hidden = field.fetch("HIDDEN", false) return if hidden field_type = field["TYPE_KIND"].upcase return "Unkown field type #{field_type}" unless %w(C N D G P).include?(field_type)
send("render_#{field_type.downcase}_type", *[field, prefix, options])
end
Upvotes: 0
Reputation: 9225
<%= hidden_field_tag ... %>
<%= your_variable_here_with_whatever_format_you_want %>
Upvotes: 1