Forum: Ruby on Rails Displaying Html in a form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Matthew W. (Guest)
on 2007-02-13 22:25
Hello,

I would like to be able to pass html code into a text_area in a form so
that it is displayed as executed code i.e. i want to be able to apply
different fonts to different words in the text_area. Is this a
possibility?

At the moment i am using text_area_tag and the html that i pass in just
seems to be displayed as a string.. which makes sense - however i need
the html that i pass in to be executed and displayed properly..

Am i using the correct container to perform this task or is there a
better one available?

The reason that i am doing this is that i would like the user to be able
to type Ruby code into a form and i would use javascript to make a call
to a function that parses the input - using the syntax plugin (generates
html from ruby code) - and then display this 'syntax highlighted' code
in the browser (in the form)..

Any ideas would be much appreciated
James S. (Guest)
on 2007-02-14 12:34
> I would like to be able to pass html code into a text_area in a form so
> that it is displayed as executed code i.e. i want to be able to apply
> different fonts to different words in the text_area. Is this a
> possibility?

Textareas are, by definition, just plain text. So i don't think this is
possible using them as they will only ever take in a string and display
it as a string.

> Am i using the correct container to perform this task or is there a
> better one available?

No, is the short answer. I am not aware of a container that will allow
you to display editable html code. However i could be proved wrong!

- j
Chris H. (Guest)
on 2007-02-14 15:52
(Received via mailing list)
you mean something like this?

http://codepress.fermads.net/
Chris H. (Guest)
on 2007-02-14 15:55
(Received via mailing list)
of course, i forgot to mention it's backend is done in php, but the
point is, it can be done.
James S. (Guest)
on 2007-02-15 19:24
Chris H. wrote:
> you mean something like this?
>
> http://codepress.fermads.net/

Yes, but would would you be able to integrate that with rails, it seems
to only load from a file or am i missing something - is it possible to
save and load from a database?
This topic is locked and can not be replied to.