save form-field as txt-file

merlin's picture

They have: 410 posts

Joined: Oct 1999

well, i'm working on some pages and don't have a lot of experience with javascripts...

next prob:
the user puts some text into a form-field (like this one).
when he's finished, he has two possiblities:
1. send the form-content as an e-mail (cgi/perl)
2. save the text as a file on his disk. when he returns, he can select 'open file', select the saved file and the script puts the content automaticalli into the form-field.

the 2nd one is the problem...
a) is it possible?
b) how can i do it?

They have: 12 posts

Joined: Oct 2000

for the second situation the only thing i could see to do would be to save the information into a cookie and then on your page use javascript to get the information in the cookie and display it on the page... if you give me a little more information about what your form is like and what fields you need to "save" i might be able to help you write the cookie...
or check out this tutorial it is how i learned
http://htmlgoodies.earthweb.com/beyond/cookie.html

NOTE: this solution will not work if the person turns their cookies off, which some people do.

Give me what I want, and I'll go away!

merlin's picture

They have: 410 posts

Joined: Oct 1999

that's what i was thinking of too. but there are some cons:
- if another user uses the same pc, it overwrites the formcontent.
- there are some people, who dislike cookies...

anyway, i'm ready to take the challenge... Wink

there are only two form-fields, that must be saved:
- one is called title, maxlength=20 type=text
- textarea, with at about 500 chars (80 words)

now, i was thinking of setting the cookie via perl, is java the easier way?

[edit]
uh, what i (almost) forgot: setting the cookie is only an option. i was thinking of a link called 'save input', when clicked, it's setting a cookie.

merlin's picture

They have: 410 posts

Joined: Oct 1999

hu, anyone helping me, setting that cookie?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.