simsalabim/sisyphus

Form values only saved once, the first time the form is saved

Closed this issue · 3 comments

VicM commented

I am using jQuery 1.9.1 and and jquery mobile 1.3.2 in a phonegap app using sisyphus 1.1.103.

Great plugin by the way, very useful.

I have noticed that sisyphus only works once. Once I am in the page that contains the targeted form, If I type data into it and then leave the page the data is correctly stored in the LocalStorage. Once I return to the page the data is restored correctly. However, If I started typing more info in the already populated fields or in new ones, if I leave the page and return later the data is restored with the data that was inserted the first time, so all of the fields values changed or populated the second time I visited the page are lost. This also happens on subsequent page visits.

If I kill the app or re-start the app, the form is saved correctly the first time the form is modified, but on subsequent visits of the page the values are disregarded and localStorage values remain unmodified.

My HTML and JS code look like this:

<form style="margin-top: 30px;" id="quoteCartForm" name="_quoteCartForm_" method="POST">
    <fieldset data-role="collapsible" data-theme="o" data-content-theme="o">
        <legend>Customer data</legend>

        <!-- ***************************
              * Customer general contact data
              ****************************-->

        <h2 class="txt-base-white">General data</h2>

        <div data-role="fieldcontain">
            <label for="quoteData_clientName">Name</label>
            <input type="text" name="quoteData_clientName" id="quoteData_clientName" placeholder="Customer Name" value="">
        </div>

        <div data-role="fieldcontain">
            <label for="quoteData_clientPhone">Phone</label>
            <input type="text" name="quoteData_clientPhone" id="quoteData_clientPhone" placeholder="phone numner" value="">
        </div>
    </fieldset> <!-- ENDS FORM COLLAPSIBLE element that encloses the whole data -->
</form>

My JS looks like this;

$(document).ready(function() {
    $('#page_quoteCart').on('pageinit', function () 
    {
       //.. more code here
       $( "#quoteCartForm" ).sisyphus();
      // more code here
      });
    });

Hi,

try update plugin to version 1.1.105. Hopefully it will work properly.

I fixed it only for manual release and as I see you're using autoRelease on submit. Hopefully #82 will fixed that for you.

VicM commented

Ok thanks! I still need to check it up because in the meantime I had to use garlic to solve the urgent problem. Thanks!