0

I'm writing a Rails application and I have button that I create as follows:

<%= button_to t('.upload_html'), ... %>

where the ... stand for the other options. So the button should have the text pointed to by .upload_html and it does. Now I want that text to have two lines. In the YAML file I had

upload_html: "turn off"

and now I want

upload_html: "turn<br>off"

with a line break inside the button label text. But this does not work. It displays the string literally including the HTML tag without linebreaking. What can I do to force the line break?

Thank you!! Best, Patrick

  • I've just discovered that if I change button_to to link_to, it works. So this must be a problem with button_to somehow ... – Patrick Bangert Jul 10 '12 at 11:24
  • this is because your text is in value attribute. you cant insert multiline content in it. you can use link_to and style your link as button – jbmeerkat Jul 10 '12 at 22:43

1 Answers1

0

did you try "turn<br>off".html_safe ?

Erez Rabih
  • 15,562
  • 3
  • 47
  • 64