facebook

Push button for selection criteria

💡
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 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #316218 Reply

    Woodgela
    Member

    Sorry for the n00b question but i’m having some difficulties linking pages together.

    I want to create a link to another page that ive created based on specific selection criteria that i have chosen from the Select Menu List. I can’t seem to create a valid link. Everytime i try to use the push button in emulator mode nothing happens. Also i need the link to take into account multiple selections from Select menu lists.

    Any help would be greatly appreciated.
    Thanks.

    #316237

    support-michael
    Keymaster

    @Woodgela
    If the UI page flow is conditional then I recommend creating your own javascript function and binding it to the Link property of your UI control that initiates the page transition. Later today I will provide snippet that demonstrates accessing SelectListMenu value access and page transition.

    #328384

    davidaflores
    Member

    @support-wayne wrote:

    @Woodgela
    If the UI page flow is conditional then I recommend creating your own javascript function and binding it to the Link property of your UI control that initiates the page transition. Later today I will provide snippet that demonstrates accessing SelectListMenu value access and page transition.

    Hi. Can you post the snippet here with screenshots and code. I too have been trying to do this but haven’t been successful at all. Thanks.

    #328408

    Hi David,

    Please take a look at this Wayne’s example and let me know if is helpful for you.

    http://www.genuitec.com/support-genuitec/viewtopic.php?p=6351#p6351

    #328440

    davidaflores
    Member

    Hi Octavio,

    It was a little. What I was trying to do and it is really getting to me is a simple conditional branching where if you have two combo boxes and 1 button – and say if the pick one thing from a combo box 1 and something else from combo box 2, when you hit the custom button, it would take you to one page, if you had a different combination, it would take you to another.

    My understanding and I may be wrong is that I need to set the variables in each combo boxes. They need to be recalled and then the function executed in the actions of the button.

    I’ve tried to simplify as well to see if I am doing this correctly and choose 1 dropbox and 1 botton. Under the dropdown box code, I wrote the following:
    <div id=”form1-combobox1″ class=”select-list-menu-spinner iscroll-no-prevent-default combobox”
    name=”combobox1″ data-hiddenInputId=”form1-hidden-select-combobox1″
    data-selectionInfoId=”form1-combobox1″ data-multiple=”false”>
    </div>
    <div class=”aux-hidden-div”>
    <select id=”form1-hidden-select-combobox1″ name=”combobox1″>
    <option value=”value1″ label=”Item 1″ selected>Item 1</option>
    <option value=”value2″ label=”Item 2″>Item 2</option>
    <option value=”value3″ label=”Item 3″>Item 3</option>
    <option value=”value4″ label=”Item 4″>Item 4</option>
    <option value=”value5″ label=”Item 5″>Item 5</option>
    </select>
    </div>

    Under the botton, I wrote:
    function e1 (){
    if $(‘select[name=”combobox1″]’).val(“value2″)
    {phoneui.gotoPage(‘m1-t2’,phoneui,transitions.FLIP_LEFT)
    }
    else $(‘select[name=”combobox1”]’).val(“value3”)
    {phoneui.gotoPage(‘m1-t3’,phoneui,transitions.FLIP_LEFT)
    }

    I don’t know if I have a syntax error or simply am missing something.

    Thanks,

    David

    #328446

    Hi David,

    I think you’re not ussing the the link hack trick: http://www.genuitec.com/support-genuitec/viewtopic.php?p=4543#p4543

    Let me know if it was the issue.

    #328517

    davidaflores
    Member

    Hi Octavio,

    I think I might be asking for the wrong thing. I need an example of how to use the conditional statements if .. else, else if to control either to go to a different .mobi page or an alert message. For example, I used an the following example code to create a simple pop window with the number entered:

    function openLink()
    {
    var myAge = $(‘#m1-test-myAge’).val();
    if(myAge!=””){
    alert(‘Your age is:’ + myAge);
    }else{
    alert(‘Please enter age!’);
    }
    }

    The problem is the following. I wanted a different message to display based on age entered:
    function openLink()
    {
    var myAge = $(‘#m1-test-myAge’).val();
    if(myAge!=>45){
    alert(‘You qualify for study’);
    }else{
    alert(‘Sorry’);
    }
    }

    I can’t get this script to work. Eventually, I wanted to do a two variable condition but I can’t even get 1 variable to work. Please help. I don’t know if it’s a syntax error etc. If you could give me an example of a two variable condition script, that would be great too.

    Thanks,

    David

    #328533

    Hi David,

    You’re using “!=>” as an relational operator, that is invalid. Please try with “<=” to compare if the first statement is equal or less than the other statement value or “>=” in opposite case. Hope this is helpful for you.

    #328538

    davidaflores
    Member

    Thank you thank you thank you. That did it. You don’t know how much of a headache that was trying to figure out why it wasn’t working.

    #328539

    davidaflores
    Member

    Hi Octavio,

    Thank you again for fixing my syntax. One last question – what am I doing wrong with this syntax:

    function openLink()
    {
    var myAge = $(‘#m1-test-myAge’).val();
    var myAge2 = $(‘#m1-test-myAge2’).val();
    if(myAge>=”4″ && myAge<=”8″ && myAge2>=”5″){
    alert(‘You qualify for study’);
    }else{
    alert(‘Sorry’);
    }
    }

    Never mind – found the syntax error.

    Thanks,

    David

    #328558

    davidaflores
    Member

    New question.

    So I’ve gotten good at the selection criteria. However, I just noticed that it loops when you have more than 4 variables and/or when you are using conditional selections on multiple pages. Do you know if that is a problem with mobione or is it my syntax again. Here is an example of the syntax that will not work:

    function question3()
    {
    var myGfr=&(‘#m1-page3-myGfr’).val();
    var myBmi=&(‘#m1-page3-myBmi’).val();
    var myHgb=&(‘#m1-page3-myHgb’).val();
    var mySbp=&(‘#m1-page3-mySbp’).val();
    var myDbp=&(‘#m1-page3-myDbp’).val();
    var myUacr=&(‘#m1-page3-myUacr’).val();
    var myFerritin=&(‘#m1-page3-myFerritin’).val();
    var myHba1c=&(‘#m1-page3-myHba1c’).val();
    var myK=&(‘#m1-page3-myK’).val();

    if(myGfr>=”25″ && myGfr<=”59″ && myBmi=” ” && myHgb=” ” && mySbp<=”150″ && myDbp<=”100″ && myUacr>=”300″ && myUacr<=”10000″ && myFerritin=” ” && myHba1c<=”9″ && myK=” “)
    {
    alert(‘Congratulations’);
    phoneui.gotoPage(‘#m1-page4’,phoneui.transitions.slideLeft);
    }else{
    phoneui.gotoPage(‘#m1-pageend’,phoneui.transitions.slideLeft);}
    }
    }

    Similar code – you can even say cut an past on previous page but with only two variables works beautifully. The one here doesn’t.

    On a side note – I really like your product.

    Thanks,

    David

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Push button for selection criteria

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