0

I have made a simple webpage with a Javascript backend. I want the user to be able to enter in a bunch of data in form fields, and then save the page. PDF, HTML, doesn't matter, I just want to be able to save the page WITH all of the user's data.

This has to be client side only, I don't want people to have to setup a server just to use it.

CobraBytez
  • 129
  • 2
  • 6
  • Maybe Javascript could replace the form elements with their values and then you'd be able to save the resulting HTML page. Or maybe JS could offer to save it in plain text for data input purposes. Would that work? – Jonathan Allard Dec 19 '11 at 04:01
  • I thought of your first idea, but when the Javascript adds to or modifies the page, they aren't included with the source - ergo I can't save it that way :(. The second option sounds good, I just don't quite know how I would go about implementing it. – CobraBytez Dec 19 '11 at 04:06

1 Answers1

1

The browser's security mechanism does not allow you to create files barring cookies. So may want to google JavaScript cookies and how to use them.

Have two pages, on your first present the form and submit it to the second page using (keep the method get:

<form action="second_page.html" method="GET"> <!-- Other stuff --> </form>

GET will send data as a part of the URL to the second page.

On the second page parse the URL to get the variables set by the user, you can use something like this. Use DHTML/JavaScript to display the values thus fetched into the format you may wish.

check123
  • 1,989
  • 2
  • 22
  • 28
  • That's a start, but I need the formatting that goes along with it, the "prettyness" of the web form if you will. – CobraBytez Dec 19 '11 at 04:02
  • That'll work in a worst case scenario, if I surround a whole bunch of smaller forms by a large main invisible form that has the submit, will the GET take all of the inner forms data as well? – CobraBytez Dec 19 '11 at 04:12
  • @CobraBytez AFAIK, HTML does not support nested forms! :( Read: http://stackoverflow.com/questions/379610/can-you-nest-html-forms – check123 Dec 19 '11 at 04:14
  • Crap, alright well still better than what I had, thanks for the help! – CobraBytez Dec 19 '11 at 04:18