Skye Dunning
Posts: 0
Joined: Wed Feb 20, 2013 2:22 am

Newby, need javascript for calculations

Hi, I'm completely new to app development. I was able to create the simple beginning tutorial and it's pretty similar to what I want. The tutorial has a text entry on page one that displays in page two:

var input = Tiggzi('Input').val();
localStorage.setItem('text', input);
Tiggzi.navigateTo('Result', {});

To start with, what I need is the javascript to replace the middle line that would do a calculation and put it on page two instead::

var input = Tiggzi('SquareFeet').val();
var total = input * .06;
Tiggzi.navigateTo('Result', {});

This will progress on to some "if, then" type calculations, but that's as complicated as it gets.

Is there a good reference for writing spreadsheet type javascript calculations without getting buried under javascript everything?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Newby, need javascript for calculations

[quote:]
Is there a good reference for writing spreadsheet type javascript calculations without getting buried under javascript everything?
[/quote]
I'm not aware of guides that do specifically that. There are many good JavaScript resources available on the Internet today, but they will be all JavaScript.

Skye Dunning
Posts: 0
Joined: Wed Feb 20, 2013 2:22 am

Newby, need javascript for calculations

Can anyone help me with a snippet of code here? Something that would take numbers in input box 1, multiply that by, say, .02 & display it on the results page? I think from there I might be able to extrapolate.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Newby, need javascript for calculations

You can use the API here to read values from input components: http://docs.tiggzi.com/javascript-api/.

Once you get the values, you can do something like this:

var total = num1 * 0.02;

I'd really recommend to try some basic JavaScript tutorials before you attempt to build a mobile app.

Return to “Issues”