facebook

Populating fields on page load/app start with saved data

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 8 posts - 31 through 38 (of 38 total)
  • Author
    Posts
  • #348303

    Code_A
    Member

    From your picture it looks like your text box is called textField1, not datafield.

    Try this instead:

    localStorage.setItem('datafield',$('#m1-locstorage-textField1').val());
    

    Retrieve then like this:

    $('#m1-locstorage-textField1').val(localStorage.getItem('datafield'));
    #348312

    Brandon
    Member

    @CodeA
    Good catch, I didnt see that.

    #348313

    falloffalot
    Member

    Hey guys thanks for the help, however this is still not working!
    Here is a screen grab with all elements visible:

    This is getting really frustrating now guys, I do appreciate the help though chaps

    #348315

    Code_A
    Member

    A few things…

    1. Confirm your mobi project file is called ‘locstorage’
    2. Make sure you are modifying and using the ‘locstorage_custom.js’ in the root of your project’s www folder. Your screen shot shows you using ‘www/untitled2/untitled2_custom.js’.
    3. Zip up your project files or an example and upload them so we can take a look.

    #348317

    falloffalot
    Member

    here you go:
    Thanks for the assist really appreciate the help

    Attachments:
    You must be logged in to view attached files.
    #348322

    Code_A
    Member

    I got it working for you and uploaded the corrected project files.

    1. Your file organization was not correct. Your mobi file was in the the same directory as the supporting files. The file structure needs to stay in tact as mobi creates it, that is the support files need to be within the www folder and your mobi file is outside of that usually separated by another folder with your project name.

    2. Your OnChange Run Javascript code was incorrect (but it is correct in the picture above…so I think the file organization was the real culprit here).

    I had to change this:

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

    To this:

    localStorage.setItem('datafield',$('#m1-locstorage-textField1').val());
    Attachments:
    You must be logged in to view attached files.
    #348333

    falloffalot
    Member

    Yippee!!!!!!!
    Thank you so much, you guys are legends!

    This has helped me out loads.
    I have got myself a copy of “Javascript for dummies” along with other self help publications to help me understand what does what & why.

    Thanks again chaps, its reassuring to know that MobiOne has such a great community!

    Can I just ask what does – #m1 – do?

    #348337

    Code_A
    Member

    Good glad to hear it worked for you.

    The way I understand it is m1 (mobione) is part of the widget ID, and the # is used by jQuery to select the object.

Viewing 8 posts - 31 through 38 (of 38 total)
Reply To: Populating fields on page load/app start with saved data

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