how to send the current page's content as part of a form

  • Thread starter Andre Charbonneau
  • Start date
A

Andre Charbonneau

Greetings,

I would like to do the following:

- I have a page with a form inside. When the user submits the form, I
would like to have a hidden variable in that form that contains the
entire page content as it was when the 'submit' button was clicked
(including the HTML, not only the form values). (The reason I want to
do this is that I want to save every 'form submission' to a database on
the server side.)

I read about the innerHTML, but it looks like its not portable across
browsers.

I suspect the solution would be using somekind of javascript, by
iterating through the DOM elements of the document and so on, but I'm
not sure...

Any ideas on how to implement this?


Thanks!
Andre
 
B

bobzimuta

Andre said:
I suspect the solution would be using somekind of javascript, by
iterating through the DOM elements of the document and so on, but I'm
not sure...

Any ideas on how to implement this?

Yes, dom would work. Check out a simple starter script I came up with
(firefox tested only)
http://em.hopto.org/code/test/javascript/test_out_src.html

Very, very basic but could possibly get the job done. Note that I put
'all possible' tags in an object, rather than using a regex search to
look for closing tags.

I have yet to test on a large page, as I guess this method would likely
take a lot of time. Think about what you'll do for css, input values,
javascript, etc...

Let me know if you get anywhere with this!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top