Page 2 of 2

if command not working

Posted: Sun Oct 26, 2014 11:54 am
by David wyatt

code
var x= Apperyio('xin').val();
var y= Apperyio('yin').val();
var xx= Apperyio('xx').val();
var xxx= Apperyio('xxx').val();
var score= Apperyio('score').val();
var yy= Apperyio('yy').val();
var yyy= Apperyio('yyy').val();
alert(x+"-"+y+"-"+xx+"-"+yy+"-"+xxx+"-"+yyy);
if (x<xx) {
alert("x low"); }
else if (x>xxx) {
alert("x high"); }
else if (y<yy) {
alert("y low"); }
else if (y>yyy) {
alert("y high"); }
else {
++score;

Code: Select all

     alert("score "+score); } 

/code


if command not working

Posted: Sun Oct 26, 2014 11:57 am
by David wyatt

Thank you, thats better. is there any update why its not working in my app?

ive also tried
code
if ( var < x || var > y )
/code
format and it still doesnt work?


if command not working

Posted: Sun Oct 26, 2014 12:18 pm
by Illya Stepanov

Please describe case in which it doesn't works correctly.


if command not working

Posted: Sun Oct 26, 2014 1:00 pm
by David wyatt

Hi,

i have the javascript running on a button command but it doesnt work. it is actually part of a another more complex app that i have built. i couldnt understand why it wasnt working so i have built this app as a debug and even with everything strip back im having the same issue. the app has been shared with apperyio support, its called hit.


if command not working

Posted: Sun Oct 26, 2014 2:30 pm
by Illya Stepanov

David,

If you mean in this case:

Image

Values in the input fields are strings, you need to convert values to integer and then perform mathematical comparisons.


if command not working

Posted: Sun Oct 26, 2014 2:41 pm
by David wyatt

Thank you, how do I convert them?


if command not working

Posted: Sun Oct 26, 2014 2:54 pm
by Illya Stepanov

You can use codeparseInt();/code more information here.


if command not working

Posted: Sun Oct 26, 2014 3:53 pm
by David wyatt

Brilliant, thank you