facebook

Toggle to show or not multipage

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    jbgglgdev
    Member

    Hi, maybe already discussed…
    I would like to show a multipage when the toggle in On and when Off hide or show another multipage.
    any help very welcome.
    Regards
    JB

    #348973

    Code_A
    Member

    You should be able to use the following code to accomplish this.

    $('#m1-<screen>-multiPage1').show();  //show multipage widget
    $('#m1-<screen>-multiPage2').hide(); //hide multipage widget
    #348988

    jbgglgdev
    Member

    Hi and thank you for the help.
    here is what I have :
    multipage2 with 2 pages, page Video and page Specs

    I added a toggle on multipage 2 and when toggle is off then video page should not show and when toggle is on video page should show.
    Specs page is the multipage2 default page.

    So on the toggle code I have :
    if ($(‘input[name=”toggle1″]’).is(‘:checked’)) {

    $(‘#m1-<screen>-multiPage2-Video’).show(); //show multipage widget

    } else {

    $(‘#m1-<screen>-multiPage2-Video’).hide(); //hide multipage widget

    }

    but it’s not working as expected…

    JB

    #348989

    Code_A
    Member

    Did you replace <screen> with your mobi screen name?

    #348999

    jbgglgdev
    Member

    Yes, I did that :

    if ($(‘input[name=”toggle1″]’).is(‘:checked’)) {

    $(‘#m1-Video-multiPage2’).show(); //show multipage widget
    $(‘#m1-Specs-multiPage2’).hide(); //hide multipage widget
    } else {

    $(‘#m1-Video-multiPage2’).hide(); //hide multipage widget

    }

    #349001

    Code_A
    Member

    I assumed your multipage widgets were on the same screen. If they are not then that code will not work. Instead you would need to use gotoScreen to switch between the screens. Once you are on the right screen, then you should be able to show/hide the widget.

    phoneui.gotoScreen("Specs");
    phoneui.gotoScreen("Video");
    #349043

    jbgglgdev
    Member

    I can not make it work… here is a simple toggle page…
    what is wrong ?
    thank you
    JB

    Attachments:
    You must be logged in to view attached files.
    #349044

    Code_A
    Member

    I would like to show a multipage when the toggle in On and when Off hide or show another multipage.

    Sorry, I thought that you were trying to toggle between two multipage widgets.

    To toggle between pages within a multipage, you can use the following code (this works for the test project you posted):

    if ($('input[name="toggle1"]').is(':checked')) {
        phoneui.gotoMultiPagePage('m1-test-toggle-multiPage1', 'SET_PAGE', 'm1-test-toggle-page1', 'NONE');
    } else {
        phoneui.gotoMultiPagePage('m1-test-toggle-multiPage1', 'SET_PAGE', 'm1-test-toggle-page2', 'NONE');
    }
    #349045

    jbgglgdev
    Member

    great, thank you ! it’s me that did not explain well 😉

    I have probably done wrong as it is not working with my file…. see mobi

    JB

    Attachments:
    You must be logged in to view attached files.
    #349094

    jbgglgdev
    Member

    I have probably done wrong as it is not working with my file….

    #349097

    Code_A
    Member

    Your code is working but the problem is that you have two multipage widgets on the screen, so when you show the pages on the second mulitpage they are covered by the first multipage widget. You need to hide the first multipage before showing the second one.

    Try this:

    $('#m1-MoteurBoatVantage230-multiPage1').hide(); //hide multipage widget
    if ($('input[name="toggle1"]').is(':checked')) {
       phoneui.gotoMultiPagePage('m1-MoteurBoatVantage230-multiPage2', 'SET_PAGE', 'm1-MoteurBoatVantage230-page9', 'NONE');
    } else {
       phoneui.gotoMultiPagePage('m1-MoteurBoatVantage230-multiPage2', 'SET_PAGE', 'm1-MoteurBoatVantage230-page10', 'NONE');
    }

    Another, solution would be to put the pages from multipage2 into multipage1 and then you could use your existing code. Just drag and drop them from one to another to move them.

    #349107

    jbgglgdev
    Member

    ok I understant better now, thank you very much for the help 😉
    JB

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Toggle to show or not multipage

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