Forum Moderators: open

Message Too Old, No Replies

Saving HTML form with content

textbox data disappears

         

Oldwood

8:28 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



I'm considering using HTML for creating forms. The forms are not meant to be published, but used on (different) browsers.
Is it possible to save the html form including the data in textboxes and settings of radioboxes etc.?
None of the browsers I'm using - Firefox, Opera, Konqueror and IE - seem to be able to do so.

ajkimoto

10:32 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



Oldwood,

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

Oldwood

8:19 am on Mar 18, 2004 (gmt 0)

10+ Year Member



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?

grahamstewart

8:38 am on Mar 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll just have to let the user 'Save' the form at the end of each session by pressing a button. (Saving would simply submit the form to a script which would store the values entered so far, but not process anything).

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.

john_k

9:29 am on Mar 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, you can grab it from a DOM compliant browser with this javascript:

 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.

Oldwood

12:56 pm on Mar 19, 2004 (gmt 0)

10+ Year Member



Thanks John and Graham. This'll get me going again.