Allowing HTML Tags in Form Fields

I wanted to allow my users to be able to include html tags in things they posted.  Originally, I was thinking that this was done as an option to the form field, but it actually is in the view where you display the user content.

In my case, I have this in the form:

<%= f.text_area :content %>

and where you want to display it, just add “.html_safe”, for example:

<%= article.content.html_safe %>

Default Values and Placeholders in Text Fields

You can place text in fields to pre-populate them or to save space by putting the label in the field with simple html.

If you want label a field, you can use the placeholder tag which works in most modern browsers:

If you want to pre-populate a field, with text, you can use the value tag which will put the text, but NOT remove it when the focus is put on the field: