actually i'hd saved the form data in local by using sysphus a jquery plugin and this is my code to save the form data in local storage.is it possible to retrive the all data at once using php Or jquery. can u please help me to retrive the stored data from local storage.

<script>
$(document).ready(function(){      // storing form data in local storage.
    $('#formElem').sisyphus();
});
</script>

<script>
 $('#formElem').submit(function() { // clearing saved data in local storage. 
        localStorage.clear();
 });
      </script>

but now i want to get all the data stored in local storage also to display.
can u please help me to display & get the data from local storage

is it possible to retrive the all data at once using php Or jquery

I looked at the code, but there is no function to retrieve all keys/values at once. Either request a feature, or fork the project and add it yourself. PHP runs server-side, so has no direct access to local storage.

Hi Venter,

I've checked sisyphus. Getting data locally should be done on client side, and sisyphus uses automatic restoration of data on inputs. Meaning, you can access them the same you access your input.

Your code one clearing data should be done using sisphus' manuallyReleaseData method. What I believe your doing is releasing or clearing data on submit. You can do so, automatically by setting sisyphus' autoRelease to true.

Here's my implementation of your code, applying what I just said earlier:
AUTOMATIC CLEARING OF DATA

<script>
$(document).ready(function(){
    //autoRelease automatically is set to tru
    $('#formElem').sisyphus();
});
</script>

MANUAL CLEARING OF DATA

<script>
$(document).ready(function(){
    //set the autoRelease to false
    $('#formElem').sisyphus({autoRelease:false});
});
</script>
<script>
    $('#formElem').submit(function() {
        //clear the data manually on submit
        $.sisyphus().manuallyReleaseData();
     });
</script>

In Retrieving the data from the client, you can do so by sending the data thru AJAX or sending the form data typically as you would on a normal form. Then, process the sent data on the server.

Additionally, sisyphus can fire event set initially or on-the-fly; these are onSave, onBeforeRestore, onRestore and onRelease.

mr.gon i want to retrive the data from local storage.suggest a piece of code to retrive the data using jquery from local storage

Sisyphus uses multiple values to name its input so, here's a function I created to simplify, somehow, how to get it from the local storage. You can extend Sisphus using this instead if you want to.

function getSisyphusData($input){
    var prefix = $.sisyphus().href + 
                 ( $input.closest("form").attr("id") || "" ) + 
                 ( $input.attr("name") || "" ) + 
                 $.sisyphus().options.customKeyPrefix;

    return $.sisyphus().browserStorage.get(prefix);
}
// use it like this
alert( getSisyphusData($("#yourInputID")) );

We've used Sysiphus' browserStorage for compatibility on with localstorage it uses. The reason behind this is beacause it can use another plugin as an alternative to localstorage.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.