# Displaying Html in a form

**URL:** <https://www.ruby-forum.com/t/displaying-html-in-a-form/85464>\
**Category:** Rails\
**Created:** [February 13, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/displaying-html-in-a-form/85464 "2007-02-13T21:25:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [February 13, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/displaying-html-in-a-form/85464/1 "2007-02-13T21:25:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [February 14, 2007, 11:34am UTC](https://www.ruby-forum.com/t/displaying-html-in-a-form/85464/2 "2007-02-14T11:34:33Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [February 14, 2007, 2:52pm UTC](https://www.ruby-forum.com/t/displaying-html-in-a-form/85464/3 "2007-02-14T14:52:29Z")

</div>

you mean something like this?

> **[fermads.net](http://codepress.fermads.net/)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [February 14, 2007, 2:55pm UTC](https://www.ruby-forum.com/t/displaying-html-in-a-form/85464/4 "2007-02-14T14:55:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [February 15, 2007, 6:24pm UTC](https://www.ruby-forum.com/t/displaying-html-in-a-form/85464/5 "2007-02-15T18:24:46Z")

</div>

Chris H. wrote:

> you mean something like this?
> 
> [http://codepress.fermads.net/](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?
