facebook

If statements

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

    bin-salmeen
    Member

    Dear,

    I would like to know how to make “If statements” for:
    1- Radio button
    2- Text Boxes
    3- Check boxes

    So i can read the value, then i can decide to which page i can transfer, based on the value selected or entered.

    please advise and ill appreciate if there is a real example!

    #344727 Reply

    nvts
    Member

    Hello,

    You will have to write code in your screen_custom.js file for this.

    To read a textfield from a M1 screen

    var screencheck=$('#m1-screen-textfield').val();

    Then a if statement or even a switch case statement to perform the conditions you need to direct the user to the correct screen.

    If you are familiar with JS then it should be pretty simple to implement. Remember that M1 is a gui designer and not a code generator. You will have to code the logic. If you search this site and view some of the examples and explore the _custom.js files for that example you will learn a lot.

    Cheers…

    #344740 Reply

    paulD
    Member

    Here is a very quick example of a toggle and a if statement.

    Basically the toggle widget fire’s a function called light();

    in the custom.js file

    function light(){
    
            if ($('input[name="toggle1"]').is(':checked')) {
      
              $('#m1-toggle-offImage').css('visibility','hidden');
              $('#m1-toggle-onImage').css('visibility','inherit');
        
            } else {
              
              $('#m1-toggle-offImage').css('visibility','inherit');
              $('#m1-toggle-onImage').css('visibility','hidden');
              
            }
            
    }

    within the if statement you can change it to go to a screen or whatever you need.

    here is a few more code snippets here http://www.genuitec.com/mobile/docs/widgetReference/widgetReference.html#select_and_input_properties

    Paul

    Attachments:
    You must be logged in to view attached files.
Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: If statements

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