facebook

Checkbox not permanent

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #329092 Reply

    moggy moo
    Member

    Moved to Getting Help forum.
    Is it possible to ensure the checkbox option, once ticked (or unticked) remains in the same state until replaced even when the app is closed and opened again.
    At the moment if I set default as unticked, then I tick the box, close down the app or mobile then run the app again the box comes on unticked, instead of the previous state it was set at which was ticked.
    Same thing happens for the toggle and button input icons.
    I’m creating an app where the user ticks the box after an action is done.
    That tick should remain, even when the program is closed.
    Seems pointless having a tick box if it’s reset to the default state every time the app is run.
    Thanks

    #349704 Reply

    Ulysse
    Member

    Hi,

    I face the same problem but no way to find the answer in the forum.

    Can anybody help?

    Thanks

    #349705 Reply

    Code_A
    Member

    You can use local storage to accomplish this:

    Save Value:

    if ($('#m1-<your-screen>-checkBox> input').is(':checked')){
                localStorage.setItem("data","true");
            }else{
                localStorage.setItem("data","false");
            }

    Get Value:

    if (localStorage.getItem("data") == "true"){
            $('#m1-<your-screen>-checkBox> input').attr('checked',true);
        }else{
            $('#m1-<your-screen>-checkBox> input').attr('checked',false);
Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Checkbox not permanent

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