Forum Moderators: open
First of all: Welcome to Webmaster World!
As for your question, I do not think that this can be easily done (I'm careful never to say 'impossible').
The issue is that the values of the form objects are not part of the html document--they only exist in your browser's memory cache.
A server-side solution is probably what you need--once you post the form, the values are readily available to the server-side form-processing code. You could then dynamically create a form with the objects set to the values that you want.
ajkimoto
Thanks. It's what I suspected.
However, the forms I'm dealing with are quite extensive and are meant to be filled out on site on a PDA. These forms are difficult to fill out completely in one session, several sessions over one day are required. Since the location where the forms are used may be quite remote and wide apart (I'm talking worldwide) and internet connections are not guaranteed, the entered information in the form should preferably be saved locally (on the PDA I mean) for the next session.
See what I mean? Does anybody have a brilliant idea?
Then when the user logs in again later you can present them with the form they last saved with the
value attribute set for the inputs that they have already filled in.
var bodyText=document.body.innerHTML; I used this on an Intranet where IE was the dictated browser, so I haven't tested it on others. From IE, it works pretty good - you only get what is between the <body> and </body> tags though. And the whitespace and tags will be altered some. If you've ever saved a file "for use offline" in IE, it is similar. But it DOES capture the current state of all form controls. And it can be used to render a snapshot of the page.
On our site, when someone clicked the "report a problem" link, the javascript would grab the HTML and it would be submitted (in a hidden field) with the rest of the error report. It really cuts down on the ambiguity of a lot of error reports.
We also used a function to disable all of the links and buttons on the page before we snagged the HTML. This was so the support person didn't have to put up with a bunch of irrelevant errors when looking at the screenshot. I can sticky that to you (or post it I guess) if you like.