473,406 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Save html-forms data to local disk?

A question on html-forms:

We have an application where users will get a CD with,
among other things, some html-forms for them to fill in.
When they click the submit-button, the data is transferred
to a webserver php-script that will then process the info.
The forms-definition looks something like this:

<form action="http://www.ourdomain.com/receiver.php" method="post">
<p>Question 1:
<p><textarea name="reply01" cols="40" rows="5"></textarea>
<p>Question 2:
<p><textarea name="reply02" cols="40" rows="5"></textarea>
<p>Question 3:
<p><textarea name="reply03" cols="40" rows="5"></textarea>
... etc ...
<p><input type="submit" value="Submit answers!">
</form>

Now, my concern is (since there might be quite a lot of data filled in),
if e.g. the internet-connection for some reason is broken
at the moment when the user clicks the submit-button,
there is a risk they will lose all the text and would have to re-type it,
which I would like to avoid, of course.

How can I best solve this issue?

Ideally, I would like to store the info on their local C: drive
before submitting, and automatically retrieve the text if they
later return to the page, but I guess that's not possible from
an html doc, right?

If so, any other suggestions how to resolve this issue?

TIA,
Jul 17 '05 #1
5 5450
I noticed that Message-ID:
<16**************************@posting.google.com > from grz02 contained
the following:
Ideally, I would like to store the info on their local C: drive
before submitting, and automatically retrieve the text if they
later return to the page, but I guess that's not possible from
an html doc, right?
Don't think so.
If so, any other suggestions how to resolve this issue?


Submit each text area separately? Possibly on separate pages with a
bit of javascript to take you to the next page.

Of course if you need an internet connection to do this the page could
come from the server with just a link on the CD.

Then after submitting each textarea separately, you could repopulate it
with the data

<p><textarea name="reply01" cols="40" rows="5"><?php print
$_POST['reply01']; ?></textarea>

etc...
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Trying saving the data into the cookie using Javascript.

Uzytkownik "grz02" <gr***@spray.se> napisal w wiadomosci
news:16**************************@posting.google.c om...
A question on html-forms:

We have an application where users will get a CD with,
among other things, some html-forms for them to fill in.
When they click the submit-button, the data is transferred
to a webserver php-script that will then process the info.
The forms-definition looks something like this:

<form action="http://www.ourdomain.com/receiver.php" method="post">
<p>Question 1:
<p><textarea name="reply01" cols="40" rows="5"></textarea>
<p>Question 2:
<p><textarea name="reply02" cols="40" rows="5"></textarea>
<p>Question 3:
<p><textarea name="reply03" cols="40" rows="5"></textarea>
... etc ...
<p><input type="submit" value="Submit answers!">
</form>

Now, my concern is (since there might be quite a lot of data filled in),
if e.g. the internet-connection for some reason is broken
at the moment when the user clicks the submit-button,
there is a risk they will lose all the text and would have to re-type it,
which I would like to avoid, of course.

How can I best solve this issue?

Ideally, I would like to store the info on their local C: drive
before submitting, and automatically retrieve the text if they
later return to the page, but I guess that's not possible from
an html doc, right?

If so, any other suggestions how to resolve this issue?

TIA,

Jul 17 '05 #3
Thanks for hint, seems like cookie could do the trick then...

Unfortunately, I dont have much experience w client-side scripting,
could someone please provide or point me to some sample-code
I could elaborate on here?

Thanks,
"Chung Leong" <ch***********@hotmail.com> wrote in message news:<GO********************@comcast.com>...
Trying saving the data into the cookie using Javascript.

Jul 17 '05 #4
Found some very helpful code here:
http://www.echoecho.com/jscookies02.htm
so that problem is basically solved now.

But just realized I have a follow-up Question:

By experiment, it seems if I have two different
html-docs in the same local directory, say c:\dir
they will share the same cookie-string.

But if I have two html-docs in different local directories,
say c:\dir1 and c:\dir2 , they will have different cookie-strings
stored independently.

So the Question now is:

Is there any way to define a "global" cookie that will
be shared by all documents stored on the local drive,
regardless of the different directory-paths?

And where can I find some documentation that describes
such implementational details?

Thanks,
Jul 17 '05 #5
You can set the domain of the cookie. Try this cookie API. Can't remember
where I got it from...

<SCRIPT LANGUAGE="JavaScript">
<!--

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current
session)
// [path] - path for which the cookie is valid (defaults to path of calling
document)
// [domain] - domain for which the cookie is valid (defaults to domain of
calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a
secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie
does not exist
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create
cookie)
// * path and domain default if assigned null or omitted if no explicit
argument proceeds
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
var base = new Date(0);
var skew = base.getTime();
if (skew > 0)
date.setTime(date.getTime() - skew);
}

// -->
</SCRIPT>
Uzytkownik "grz02" <gr***@spray.se> napisal w wiadomosci
news:16**************************@posting.google.c om...
Found some very helpful code here:
http://www.echoecho.com/jscookies02.htm
so that problem is basically solved now.

But just realized I have a follow-up Question:

By experiment, it seems if I have two different
html-docs in the same local directory, say c:\dir
they will share the same cookie-string.

But if I have two html-docs in different local directories,
say c:\dir1 and c:\dir2 , they will have different cookie-strings
stored independently.

So the Question now is:

Is there any way to define a "global" cookie that will
be shared by all documents stored on the local drive,
regardless of the different directory-paths?

And where can I find some documentation that describes
such implementational details?

Thanks,

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Barry | last post by:
Hello, I've recently noticed that someone can simply type in the URL to my javaScript, from my HTML source code, to the explorer location bar and an auto-save dialog pops up to let them save it...
3
by: 00steve | last post by:
Hi, I was wondering if anyone knew how to go about having a "save as HTML" option incorporated within a page. (I know the option is available from the file menu from within IE, but a client has...
10
by: Prakashsir | last post by:
I have desgined script to show div at runtime. Now I want to copy that newly created div and/or to save in normal html file so that i can see later. 1. When I select all the content or view its...
1
by: J. Koskey | last post by:
Background: We have hundreds of codes = specific departments, but there are frequent changes/additions to the info. For users to look up definitions, we had set up a way in Access to create a...
3
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in...
4
by: eewwttww | last post by:
how to save with only WebBrowser: save html+picture without dialog box? what I Have is: WebBrowser.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, 300, 300 I don't want this code. I want...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
3
by: fiefie.niles | last post by:
I would like to save a web page to a file and have the hyperlinks work when I bring the file back up. If the web page has a hyperlink like the following <a href="OurWeb/News/abcFile.htm">, after...
2
by: csgraham74 | last post by:
Hi, I have a requirement in work that i give a person the ability to create a html document using a richt text editor. What i then want to do is save the HTML doct to my server & insert...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.