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

Calculating Fields

You can read any page inputs with jQuery or using the Appery(..) function. It's actually pretty simple. You will find examples here: http://docs.appery.io/javascript-api/

Matthew6439702
Posts: 0
Joined: Sun Nov 24, 2013 1:10 am

Calculating Fields

I have gone thru all your examples tutorials. I think what I need to see is the backend. Is there a way to see the HTML or Javascript or CSS and edit there?

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

Calculating Fields

You can view the source in Source tab.

You can also edit there but do keep in mind that if you make changes to the page code, the visual builder will not be longer updated (you can a always roll back the changes)

Matthew6439702
Posts: 0
Joined: Sun Nov 24, 2013 1:10 am

Calculating Fields

Thank you

Matthew6439702
Posts: 0
Joined: Sun Nov 24, 2013 1:10 am

Calculating Fields

//This
var x = Appery('input1').val();
var y = Appery('input2').val();
var z = (x) + (y);

var res = z;
alert (res);

//instead of this
var x = $("input1");
var y = $("input2");
var z = x + y;

var res = z;
alert (res);

This is what I have been stuck on

var z = x + y only connects the two strings. I spent quite a while trying to figure out that it had to be (x)+(y) to get the sum. I am catching on to the Appery instead of $. Just all the examples I have been learning are slightly different than what works on Appery. You guys are used to it I am sure but I keep putting } at the end of functions and it keeps the script from working then I look back and realize what happened.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Calculating Fields

Hi Matthew,

Use function 'parseInt' to convert string to int:prevar num = parseInt("10");/pre
Variable 'num' value will equal 10 (int). You can then sum it.

Also you should use preAppery('input1').val();/preinstead of:pre$("input1")/preas $("input1") returns null (you use sample by 'input1' tag, not by ID or by name).

Matthew6439702
Posts: 0
Joined: Sun Nov 24, 2013 1:10 am

Calculating Fields

I have figured out that my problem has to do with calling the value of the field in a generated list. The below script works outside of a generated list. I used a collapse box to fill in data from my database. I can call the value of every input field outside of the generated list but when I put the grid back in the collapse box I can't seem to find the value of the selected collapse block of my generated list. How can I find the input field and it's value that ties to the collapse block I expand/choose?

var servinput= Appery('ServingsInput');
var num = servinput.val();
var protein = Appery('Protein');
var num1 = protein.val();
var prtAdjust = num * num1;
var getval = Appery('prtCalc');
getval.val(prtAdjust);

var fat = Appery('Fat');
var num2 = fat.val();
var fatAdjust = num * num2;
var getval2 = Appery ('fatCalc');
getval2.val(fatAdjust);

var carb = Appery ('Carb');
var num3 = carb.val();
var carbAdjust = num * num3;
var getval3 = Appery ('carbCalc');
getval3.val(carbAdjust);

var servWt = Appery ('ServWt');
var num4 = servWt.val();
var srvwtAdjust = num * num4;
var getval4 = Appery ('ServWtAdj');
getval4.val(srvwtAdjust);

var servMeasure = Appery ('ServMeasure');
var num5 = servMeasure.val();
var srvmsrAdjust = num * num5;
var getval5 = Appery ('ServMeasureAdj');
getval5.val(srvmsrAdjust);

Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Calculating Fields

Hello! Could you give us your public app link or share app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Calculating Fields

Thank you! What are the steps to reproduce?

Return to “Issues”