User input - spit code to browser

Hi, I am having trouble figuring out how to do this…

I am developing a new ruby on rails project and
I am trying figure out how to write code so that when a user inputs
their info into a form and they click on submit (or in my case, “get
code”)
the code generated will show in the browser so that they can copy and
paste that code into their own html doc.

is there a way to do this with ruby? If so, I would greatly appreciate
any
help on this :slight_smile:

thanks in advance!

Jeremy

On Thu, May 8, 2008 at 11:00 AM, Jeremy Jeremy
[email protected] wrote:

I am developing a new ruby on rails project and
I am trying figure out how to write code so that when a user inputs
their info into a form and they click on submit (or in my case, “get
code”)
the code generated will show in the browser so that they can copy and
paste that code into their own html doc.

Whatever you put in the view will be shown in the browser. Perhaps
you can clarify how your situation is different than normal?


Hassan S. ------------------------ [email protected]

Hassan S. wrote:

On Thu, May 8, 2008 at 11:00 AM, Jeremy Jeremy
[email protected] wrote:

I am developing a new ruby on rails project and
I am trying figure out how to write code so that when a user inputs
their info into a form and they click on submit (or in my case, “get
code”)
the code generated will show in the browser so that they can copy and
paste that code into their own html doc.

Whatever you put in the view will be shown in the browser. Perhaps
you can clarify how your situation is different than normal?


Hassan S. ------------------------ [email protected]

Hi there, I apologize.

What i mean is… you have a basic page with a form on it. the user
inputs the info into the form. Then when they click on the submit
button… it produces the information into code viewable for the user to
see.

an example is if i had a page where a user could enter a size, width and
upload a picture into the form that is available on that page… then
they hit the submit button. it would generate the code in the browser to
tell the user what code they would need to put it on their own html doc.
much like this code…
so they enter their information into the form… they hit the submit
button and this is what is produced on their browser window.

I hope that clears things a little :slight_smile:

Thanks for your help.

i want it to act ALOT like this form at the bottom of the page

http://www.mozilla.org/docs/web-developer/css1technote/css1tojs.html

On Thu, May 8, 2008 at 11:12 AM, Jeremy B.
[email protected] wrote:

an example is if i had a page where a user could enter a size, width and
upload a picture into the form that is available on that page… then
they hit the submit button. it would generate the code in the browser to
tell the user what code they would need to put it on their own html doc.
much like this code…

So you’re not talking about code, you’re talking about markup.
There /is/ a difference :slight_smile:

… and this is what is produced on their browser window.

require ‘cgi’
example = ‘
CGI.escapeHTML(example)

is probably what you’re looking for. There are probably alternatives,
but
I’m new to RoR too :slight_smile:

HTH,

Hassan S. ------------------------ [email protected]

So you’re not talking about code, you’re talking about markup.
There /is/ a difference :slight_smile:

… and this is what is produced on their browser window.

require ‘cgi’
example = ‘
CGI.escapeHTML(example)

is probably what you’re looking for. There are probably alternatives,
but
I’m new to RoR too :slight_smile:

HTH,

Hassan S. ------------------------ [email protected]

Oh yeah, duh…lol i guess i should have said markup… sorry bout that

Okay I will try that :slight_smile: thanks very much for your help!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs