Displaying Html in a form


#1

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


#2

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

#3

you mean something like this?

http://codepress.fermads.net/


#4

of course, i forgot to mention it’s backend is done in php, but the
point is, it can be done.


#5

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?