Results 1 to 2 of 2
  1.    #1  
    Hi all,
    I am really struggling with using a cookie to store the preferences in my app. I am trying t set the cookie the first time the app runs, then every other time it checks to see if it has been changed. I seem to havedone the right thing as far as declaring the cookie but everytime I try to retrieve the value I get [object object].
    I have searched on the forum and on Palm developpers but examples have not been able to help me. Can someone post some code and define where it is supposed to (scenes), or if someone has a link where everything is explained in details that would be much appreciated.

    Thanks.
  2.    #2  
    Here is more about te code I use currently:

    Saved under models is cookie.jsjsjs:

    function ConvCookie()
    {

    }

    ConvCookie.prototype.initialize = function()
    {
    this.cookie = new Mojo.Model.Cookie('converterPrefs');
    this.oldPrefs = this.cookie.get();
    if(this.oldPrefs)
    {
    // If current version, just update globals & prefs
    if(this.oldPrefs.versionString == Converter.versionString)
    {
    Converter.testValue = this.oldPrefs.testValue;
    Converter.versionString = this.oldPrefs.versionString;
    }
    else
    {
    Converter.versionString = Converter.versionString;
    Converter.testValue = Converter.testValue;
    // migrate old preferences here on updates of FreshBooks App.
    }
    }

    this.storeCookie();
    };

    ConvCookie.prototype.storeCookie = function()
    {
    this.cookie.put(
    {
    testValue: Converter.testValue,
    versionString: Converter.versionString
    }
    );
    };


    Under my StageAssistant.prototype.setup, I have:

    this.cookie = new ConvCookie();
    this.cookie.initialize();


    And finally under my main scene, I try to retrieve the cookie values:

    this.cookie1 = new Mojo.Model.Cookie('converterPrefs');
    this.currentStuff.innerText = this.cookie1.get();

Posting Permissions