2

I have a typical HTML form, with some fields of various types on it. What I'm trying to achieve is the following:

  1. Once the form's input fields are filled out with values, a button to be able to save all the filled-out field/value pairs into a local file of some sort that allows me in a future ocassion to...

  2. Automatically fill the very same HTML form by retriving the field/values pairs from said file instead of typing them manually.

Ideally this would have to be achived thru JavaScript, because the webpage that contains the HTML form is served by an embedded system where PHP or other server side scripting is not available.

Is it possible to achive this thru JavaScript (or any other browser-side effort method)? If so, how? Many thanks.


EDIT: The target environment is a regular user in a regular PC/laptop using any one of the 4 major browsers. It's acceptable to have "Cookies enabled" and "latest browser version installed" as requisites, but external plugins/addins are not.

Later: NullUserException has achived something in this direction. He's been able to read from a local file using JavaScript: Using a local file as a data source in JavaScript

Community
  • 1
  • 1
M. Suscripto
  • 423
  • 4
  • 8
  • In general its not possible due to security restrictions on JavaScript. However, it may be possible depending on the environment you have. You should be more specific in your question about the target environment. – Dwayne Towell Oct 22 '13 at 04:49

3 Answers3

1

I think, for your particular site you can store data in local storage. Only your application will be able to access to that data. Also you can encrypt it before storing.

You can refer diveintohtml5.info/storage to start with.

Happy coding.

Sandeep
  • 69
  • 5
  • Thank you Sandeep, I'll read on that link. I'll put the credit of the answer to you for facilitating the link, although griegs would deserve half of it as well. Looks like it's more complex than I thought. – M. Suscripto Oct 25 '13 at 00:59
0

Pretty sure you won't be able to save a file locally and then pick it up again.

However there are obviously cookies but there, and this is only in a modern browser, is also LocalStorage that can hold quite a bit of data that can be retrieved by Javascript and jQuery.

This is probably the way I would go but it does depend on your browser version.

griegs
  • 22,624
  • 33
  • 128
  • 205
  • I don't mind that my form imposes an updated browser as a requisite as long as it can be done and it's not a one-browser only trick (like IE only). I never heard of LocalStorage, can you point me to some link to have a look? Thanks! – M. Suscripto Oct 22 '13 at 05:05
  • http://www.jquerysdk.com/api/jQuery.localStorage Just google JQuery and LocalStorage – griegs Oct 22 '13 at 20:43
0

question is some what ambiguous please specify what you are trying to do.

i can't tell if you want to do something just for you if so: https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/

PDA
  • 766
  • 6
  • 10
  • It's not a "for me only" project Anthony, so a firefox addin isn't an option. It would have to be something standard and cross-compatible among browsers. Thanks anyway. – M. Suscripto Oct 22 '13 at 05:07