Results 1 to 7 of 7
  1.    #1  
    Hi,

    could you please tell me how to store settings in my program?
    Now I use cookies, but I've noticed they are empty after several hours.

    My code is:
    Code:
    var login = new Mojo.Model.Cookie("s");
    var password=new Mojo.Model.Cookie("p");
    var exp = new Date("December 30, 2055 00:00:00");
    login.put(this.controller.get('loginid').mojo.getValue(),exp);
    password.put(this.controller.get('passid').mojo.getValue(),exp);
    Where I'm wrong?
  2. #2  
    I've never had any trouble with cookies and the only thing I do differently to you is to not set an expiration date. I can't find the link but I remember seeing somewhere that the default exp. date is fairly high.

    Also, I only ever use one cookie in my apps, and have it store everything either in an object or an array. But hey that's just me :-)
  3.    #3  
    I'll try to decrease exp time.

    BTW, How do you use one cookie for storing several values? JSON?
  4. #4  
    Simply create the object then store it in the cookie:

    Code:
    var mySettings = {
        login: 'login',
        password: 'pass',
        type: 2,
        otherSetting: 'blah'
    };
    
    myCookie.put(mySettings);
  5.    #5  
    Thank you
  6. #6  
    default cookie timeout in a web-browser is 'when the browser session ends' in Mojo, it's never. Seriously, app cookies are even backed up to your Palm Profile so they get restored when you replace your phone or doctor it. As a general rule only set an expiration in, say, testing where you actually want the cookie to reset, for time-sensitive data or security, like only allowing persistent login for 2 weeks.
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.
  7.    #7  
    Thank you for explanation!

Tags for this Thread

Posting Permissions