facebook

How to display data on startup using Local Storage? CLOSED

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

    PaulLeBlanc
    Participant

    Hello All,
    The following code is taken from my “custom.js” file on my start-up form, so it is the first to load. The data is there and can be displayed in my alert calls, but does not display in any of teh text boxes. I had to create a separate button to call
    the function “begin()” in order to get the data to display. I want the data to display on initial startup automatically.

    Any ideas on why it does not display on “startup”?
    Thanks,
    Paul

    // ********** get defaults from local storage **********
    get_data(); // retrieves data from Local Storage
    parse_data();
    sel_aircraft = fld1;
    sel_ac_desig = fld2;
    taxi_time = fld3;
    // alert(fld1+”-“+fld2+”-“+fld3);
    // alert(sel_ac_desig);
    if (fld1 == “-“) {
    $(‘#m1-quickplanning-lblselAC’).text(“Select an Aircraft”);
    } else {
    $(‘#m1-settings-text4’).text(fld1); // on this page
    $(‘#m1-quickplanning-lblselAC’).text(fld1); // on qp page
    $(‘#m1-QP_Results-txtAC’).text(fld1); // test on results page
    // alert(“from get data sub – “+sel_aircraft);
    }

    function begin() {
    alert(“I’m here!”);
    $(‘#m1-settings-text4’).text(fld1); // on this page
    $(‘#m1-quickplanning-lblselAC’).text(fld1); // on qp page
    $(‘#m1-QP_Results-txtAC’).text(fld1); // test on results page
    }

    #336093 Reply

    @pwleblanc,

    You can call your begin function in the phoneui.documentReadyHandler function:

    phoneui.documentReadyHandler = function() {
    //instructions
    begin();
    //more instructions if are required

    }

    #336095 Reply

    PaulLeBlanc
    Participant

    Thanks so much, Octavio.

    #336116 Reply

    Hi Paul,

    Glad to help. I’ve closed the thread.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: How to display data on startup using Local Storage? CLOSED

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