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
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?
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?
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.
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
… 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