facebook

Javascripting

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

    steven.davis
    Member

    I have downloaded Mobione it appears to be a very nice package. It appears you have laid out the container and all somebody needs to do is fill in the appropriate java scripting to make real functionality. Since you have already done the container if I was going to use 2 input fields and some sort of out field with a button trigger how would your java script appear for “Output = Input1 * Input2 if a button were pushed”. This would give me an example of what code I need to write and what you have already done.

    #341354

    Hi Steven,

    Next snippet of code should work:

    var val1 = parseFloat($("#m1-myapp-textField1").val());
    var val2 = parseFloat($("#m1-myapp-textField2").val());
    
    var sum = val1+val2;
    alert(sum);

    Note that I used parseFloat(), since the value that you get with: $(“#m1-myapp-textField1”).val() is a string and if you tried val1+val2 without parsing to float or integer, you would get a new string with values appended instead the sum of the numbers.

    Hope this make sense. To learn more about how to interact with Mobione widgets and get more snippets of code see this doc: http://www.genuitec.com/mobile/docs/widgetReference/widgetReference.html

    #341357

    Stu Wade
    Member

    You beat me Octavio 🙁

    Here is a full working example – note I too use a workaround to avoid concatenation…

    Virtually all the code is in the testCalc_custom.js file

    Hope this helps

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

    steven.davis
    Member

    Thank You for the help – new to this app thing

    Steve

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Javascripting

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