facebook

Fire event after phoneui.gotoPage

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

    lemorlenny
    Member

    I’m a bit confused,
    from a main page I call a secondary page with:

    
    phoneui.gotoPage('m1-pagename'); 
    

    command, I inserted in the secondary page the istruction:

    
    alert("Hello");
    

    inside and outside from any function present but the instruction it never fired.
    In the forum I have read about use an hidden link placed inside the page to solve this
    behaviour but I’m not sure to have really understood.
    Can you explain a bit more about it?.

    Regards

    Lenny

    #336659 Reply

    Unknown Author
    Participant

    In the postpagetransition function:

    
    if currentpageId=='#m1-whatever'
    {dowhatever}
    
    #336675 Reply

    lemorlenny
    Member

    @1thinchip wrote:

    In the postpagetransition function:

    
    if currentpageId=='#m1-whatever'
    {dowhatever}
    

    Thanks for your reply,
    I tried this in my secondary page:

    
    phoneui.prePageTransition = function(currentScreenId,targetScreenId) {
      alert(currentScreenId);
      alert(targetScreenId);
      return true;
    }
    
    phoneui.postPageTransition = function(newScreenId) {
      alert(newScreenId);
    }
    

    but no one alert will fired.
    I call the secondary page programmatically with:

    
    function callpage() {    
        [CUT]
        phoneui.gotoPage("m1-SecondaryPage",phoneui.transitions.slideLeft);
    }
    

    The secondary page will called without error but no events fired.
    Meanwhile I understand to think to the mobi pages like an unique page.

    Regards

    Lenny

    #336679 Reply

    @lemorlenny,

    From your last post I guess you have added the alert code in a <secondaryPage>-www/secondaryPage_custom.js file, then, when you run your <MainScreen>.mobi the alert code(and all code in secondaryPage_custom.js) isn’t included automatically in your <MainScreen>-www/MainScreen_custom.js file. You need to move your code from secondaryPage_custom.js to MainScreen_custom.js see it working. Hope this helps

    #336680 Reply

    Unknown Author
    Participant

    For one thing, you’re using the wrong screen IDs – use the default <name>_custom.js as your model.

    For another thing, you’re not specifying with an if statement when it should fire.

    Rather than modifying your code for you, here’re some examples.

    
    phoneui.postPageTransition = function(newPageId) {
    if (newPageId == '#m1-Settings_iphone4')
     {phoneui.preprocessDOM('#m1-Settings_iphone4');}
    }
    
    
    phoneui.prePageTransition = function(currentPageId,targetPageId) {
      // add custom pre-transition code here
      // return false to terminate transition
    if (targetPageId == '#m1-Homepage_iphone4' && currentPageId == '#m1-SecondBlank4')
        {initialize();}
    }
    
    #336722 Reply

    lemorlenny
    Member

    @support-octavio wrote:

    @lemorlenny,

    From your last post I guess you have added the alert code in a <secondaryPage>-www/secondaryPage_custom.js file, then, when you run your <MainScreen>.mobi the alert code(and all code in secondaryPage_custom.js) isn’t included automatically in your <MainScreen>-www/MainScreen_custom.js file. You need to move your code from secondaryPage_custom.js to MainScreen_custom.js see it working. Hope this helps

    If I understood, all function in called pages will be never fired?

    #339830 Reply

    Rathinavel
    Member

    i used multipages widget in my project.

    this is not useful in multipages widget.

    Is there any other phoneUI functions I need to use?!?!

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Fire event after phoneui.gotoPage

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