Click here to Skip to main content
11,432,427 members (62,837 online)
Click here to Skip to main content

jsRemember

, 11 Aug 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Save the form entries to local storage preventing loss of data on browser crashing

Introduction

The jsRemember plugin saves form entries to local storage preventing loss of data on browser crashing. It will work with most common form elements such as Text, Textarea, Password, Select (Combobox), Radio, and Checkbox.

Supported browsers include IE6+, FF2+, Safari4+, Chrome4+, Android 2+, and Opera 10.5+.

In short, if you fill in a form and close the browser, when you come back again, your data will be still there. But when the page is submitted, all stored data is cleared.

It requires jStorage by Andris Reinman to work (included with the download package above).

Using the Code

Using jsRemember is quite easy! Just call it like any other JavaScript code like this:

<head>
...
<script src="js/json2.js"></script>
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jstorage.js"></script>
<script src="js/jsRemember.js"></script> 
... 
</head>

And then, all you need to do is get free writing your HTML forms because jsRemember doesn't depend on an element's name, ID, or CSS class to work. Just call it and you are done!

...
<form>
    Text field: <input type="text" size="30">
</form>
...

See the online demo page here.

That's it! Hope this saves your time dealing with cookies, view state, or something. Enjoy!

Thanks for your time reading this.

Points of Interest

I have not tested it with the newer HTML5 input types. Anyways, it's easy to extend by using the right jQuery selectors. Please see the jQuery selectors API documentation here.

History

  • 07-26-2013: Original tip.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Celso Jr
Software Developer PNCQ
Brazil Brazil
I'm currently working as programmer at PNCQ - Programa Nacional de Controle de Qualidade. I have wrote a program in C#/Winforms called PNCQ Gestor for this company.
Since 2001, when I get started writing some HTML scripting I have been in touch with some scripting and with some programming languages. But JavaScript/jQuery, HTML5 and C# are my preferred ones.
As I also have a good background in design, I'm passionate by everything about design and development.
I must also say that I'm an expert on eating kitty's biscuit....

Comments and Discussions

 
SuggestionSuggestion for improvement [modified] Pin
Celso Jr25-Aug-13 9:07
memberCelso Jr25-Aug-13 9:07 
QuestionCan some form input be saved after submit, in case of a bad CAPTCHA? Pin
Dan Knauss22-Aug-13 13:09
memberDan Knauss22-Aug-13 13:09 
AnswerRe: Can some form input be saved after submit, in case of a bad CAPTCHA? Pin
Celso Jr25-Aug-13 9:03
memberCelso Jr25-Aug-13 9:03 
Questionneed help Pin
Tridip Bhattacharjee29-Jul-13 5:43
memberTridip Bhattacharjee29-Jul-13 5:43 
AnswerRe: need help Pin
Celso Jr29-Jul-13 8:05
memberCelso Jr29-Jul-13 8:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150428.2 | Last Updated 12 Aug 2013
Article Copyright 2013 by Celso Jr
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid