facebook

example using buttons and a display output? CLOSED

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

    johnjohn
    Member

    Hi I am very new to programming. Looking at your demo video in which it seems easy to create apps, I gave your software a try if it would be suitable for me. I am still undecided if MobiOne could be easy enough for me. So I wonder if you could help me with the following.

    If I have 2 buttons (number 1 and 2) and a display box on the screen. If I press number 1, it will show 1 on the display and and if I pressed 2 next it will show as 12. Whatever I pressed would show on the display box. Can you show me such a code in MobiOne.

    Thank you.
    John

    #344833 Reply

    Brandon
    Member

    There are several ways to do this. This one uses the Javscript string manipulation (you can also do it without this, but this way will also help you learn Javascript).

    If you want to add the text to the textbox in the button select the Run Javascript action.

    Then, get the current textbox val into a variable:

    myText = $(‘#form1-textArea1’).val();

    Next add the text you want to add to a variable:

    newText = ” This is the new text.”; //each button would have its own text to add.

    Now you can use the concat method to joind the strings:

    $(‘#form1-textArea1’).val(myText.concat(str2));

    Resources:
    http://www.genuitec.com/mobile/docs/widgetReference/widgetReference.html#select_and_input_properties
    http://www.w3schools.com/jsref/jsref_concat_string.asp

    #344848 Reply

    johnjohn
    Member

    Thanks a lot for your help. It really got me started. Appreciate it!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: example using buttons and a display output? CLOSED

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