Page 1 of 1

Adding sum of fiield to another field.

Posted: Thu Sep 04, 2014 5:28 pm
by CarmeloMilian

I am trying to get the contents of one field added to the contents of another field. This is what I am doing on NiceTotal label value change. myMh was established as a setting with value of 0.

var nicefieldtotal = Appery('NiceTotal').text();
myMh = myMh + nicefieldtotal;
Apperyio("NiceTotal").text(myMh);


Adding sum of fiield to another field.

Posted: Thu Sep 04, 2014 5:59 pm
by Evgene Karachevtsev

Hello Carmelo,

Please specify, NiceTotal and myMh are labels or inputs?


Adding sum of fiield to another field.

Posted: Thu Sep 04, 2014 7:24 pm
by CarmeloMilian

NiceTotalnis a label, myMh is a setting with value if 0


Adding sum of fiield to another field.

Posted: Thu Sep 04, 2014 8:14 pm
by Evgene Karachevtsev

Carmelo,

Could you please specify
[quote:]myMh is a setting with value if 0[/quote]
what setting?


Adding sum of fiield to another field.

Posted: Thu Sep 04, 2014 10:35 pm
by CarmeloMilian

I created a new service and chose settings. There I created myMh and gave it a value of 0.

here is my app.

http://appery.io/app/mobile-frame?src...

Click login, no credentials. Then "My hashlets"

The label that says "Total: 0 MH" is totalMhlbl, it must contain the addition of all input fields in the form. I am trying to start with the one that is named NiceTotal. Its right under Nicehashlet.

This was my attempt

var nicefieldtotal = Appery('NiceTotal').text();
myMh = myMh + nicefieldtotal;
Apperyio("NiceTotal").text(myMh);


Adding sum of fiield to another field.

Posted: Fri Sep 05, 2014 1:55 am
by Yurii Orishchuk

Hi Carmelo,

Here is code for you:

pre

var niceTotal = parseInt(Apperyio("NiceTotal").val());
Apperyio("totalMhlbl").text("Total: " + niceTotal + " MH");

/pre

Also you can add to this code some your logic.

Regards.