Hi, i have a text field in html format “It is a sunny
day.
Bye”
When i put in the rhtml
<%= news.text_field %>
I get printed the text with the tags inside…
is there a to_html or soemthing like that?
thanks
Christian
Hi, i have a text field in html format “It is a sunny
day.
Bye”
When i put in the rhtml
<%= news.text_field %>
I get printed the text with the tags inside…
is there a to_html or soemthing like that?
thanks
Christian
On 6/20/07, cfingerh [email protected] wrote:
Christian
You may need to provide some more information about what your trying to
do.
An HTML Text field, or textarea will not render as html. They only
contain
text. Perhaps something like tinyMCE or similar javascript powered rich
editor is what your after.
Daniel
I will try to explain it better…
It is not for editing or creating a text. I already have the text in
my table-database
I have
<% for new in @news %>
Title:
And the text field has html tags inside (divs and spans)
The result is that the text printed is with the tags.For example
Title: New Member in the Society
The society wants to <span class="bold">announce</span>
that:
Mr etc, etc
Title: New Member in the Society
The society wants to announce
that:
Mr etc, etc
sorry…
<%= new.text %>
text is the name of the field
thanks
On 6/20/07, cfingerh [email protected] wrote:
<%= new.title.text %> The society wants to <span class="bold">announce</span>
that:
Mr etc, etc
Where does the text method come from in this line?
<%= new.title.text %>
It seems that title is an attribute of the AR model, but there is no
text
method that I know of on String. What kind of object is it?
On 6/20/07, cfingerh [email protected] wrote:
sorry…
<%= new.text %>
text is the name of the field
thanks
Cool. That makes more sense to me.
There is nothing imediate that jumps to mind except that at some point
it
seems that the tags are being escaped.
If you select these directly from the database, or using the console.
Is
the markup like
The society wants to announce
that:
Mr etc, etc
Or is the tags escaped? Like
The society wants to <span class=“bold”&gr;announce</span>
that: <br> Mr etc, etc
I get it printed like
The society wants to announce
that:
Mr etc, etc
but in the Page Source it is tags escaped …
The society wants to <span class=“bold”&gr;announce</span>
that: <br> Mr etc, etc
I found the problem.
I had
<%=h new.text %>
not
<%= new.text %>
Anyway thank you very much Daniel
In the screen I get it
The society wants to announce
that:
Mr etc, etc
The society wants to <span class=“bold”&gr;announce</span>
that: <br> Mr etc, etc
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs