views:

25

answers:

2

How would i do the following.

My current code is :

<%= f.label :email, html_escape("<span class=\"big\">Test</span>")   %>

This doesn't shows what i want, because the

<span class=\"big\">Test</span>

is shown as text instead of HTML.

I have been thinking of overriding the FormBuilder, but i don't know how i would do this and searching for something similar hasn't solved my problems.

Also, instead of Test i want to show the variabel: email.

I just want to solve the problem that i have :)

PS. I'm using Rails 3.0.

A: 

You are html_escape'ing the span...that is why the span html is showing up on your page. If you get rid of that, it'll just render as html, which is what you want.

Dave Pirotte
Originally i didn't used the html_escape, standard it was rendered as text.I needed one of the 2 methods above (raw or .html_safe)
NicoJuicy
+4  A: 

All helper in rails 3 are html_escape, so it's not anymore needed.

don't use html_escape and it's works fine. You need use raw

<%= f.label :email, raw("<span class=\"big\">Test</span>")   %>

Or you can mark this chain as safe

<%= f.label :email, "<span class=\"big\">Test</span>".html_safe  %>
shingara
You solved my problem, thanks :)
NicoJuicy