facebook

Autosave / Recall Text box with local storage

  1. MobiOne Archive
  2.  > 
  3. Examples, HOW-TOs
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #336506 Reply

    Brandon
    Member

    Here we are going to save textbox information as the user puts it in. We are also going to recall this information in the document load function.

    Saving the data:
    In your textbox set the On Change action to Run Javascript and use the following code:

    localStorage.setItem('myName',$('#m1-yourForm-textField1').val());

    That going to save the text entered into the textbox into local storage as ‘myname’

    In your document load function we are going to recall the information and send it back into the textbox.:

    $('#m1-yourForm-textField1').val(localStorage.getItem('myName'));

    Thats it, should now have a autosave and recall for your textbox.

    #348299 Reply

    falloffalot
    Member

    Have tried this one and sent it to my iPhone instead on iPad and still not saving!
    Would this work on both native apps and web apps?

    #348573 Reply

    Brandon
    Member

    Yes, this works with both native and webapps.
    The key is to make sure you get the right screen names and text widget names, not to mention the same localStorage name.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Autosave / Recall Text box with local storage

You must be logged in to post in the forum log in