Page 1 of 2

Page will not load in test

Posted: Thu Jan 09, 2014 10:16 pm
by Jay6395558

I have a page that will not load. When I tap on the Spherical Near-Field Calculator button on my home page the screen freezes. It says there is some sort of syntax/token authentication problem. It is the only button/page that does not currently work on the app. I am only testing the app and have not made it public yet. Please help.


Page will not load in test

Posted: Thu Jan 09, 2014 10:43 pm
by Alena Prykhodko

Hello Jay,

Please try debugging http://docs.appery.io/documentation/d...
What exact error do you get?


Page will not load in test

Posted: Fri Jan 10, 2014 2:32 pm
by Jay6395558

event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Uncaught SyntaxError: Unexpected token ;

I added some javascript to occur when a button is tapped but I wouldn't think that has any impact on the loading of the page since the javascript should not be read until the button is tapped. You'd need to be on the page first to access the button and activate the javascript.


Page will not load in test

Posted: Fri Jan 10, 2014 2:44 pm
by Jay6395558

I just turned off the javascript I wrote on that page and the page loaded fine. It appears it is a problem with the script I wrote. Can you take a look and let me know what I am doing to cause the problem? Here is the script...

var input = Appery('mobiletextinput_30').val();
var input2 = Appery('mobiletextinput_29').val();
var inputunit = Appery('mobileselectmenu_26').val();

var diameter = input*inputunit;

// Now we have the diameter in feet, and the frequency in GHz
var lambda = 0.3/input2;

// Calculate the record increment
var ri = 180/(((3.1416*diameter)/lambda)+10);

// Calculate the number of points
var points=64800/(ri*ri);

alert ("Number of Grid Points on Full Sphere is" + points + '"\n Record Increment is" +ri)


Page will not load in test

Posted: Fri Jan 10, 2014 3:01 pm
by Jay6395558

Actually, I just figured out the problem and it is working now. Thanks.


Page will not load in test

Posted: Fri Jan 10, 2014 3:03 pm
by Kateryna Grynko

Jay,

Glad it's working! Let us know if you need any further help.


Page will not load in test

Posted: Fri Jan 10, 2014 3:05 pm
by Jay6395558

Actually, I know am thinking of one other thing I would like to do with this script. I currently have the result of the calculation appearing as an alert but would prefer to have them appear in two labels I have on the page. How would I tell the labels to show the result?


Page will not load in test

Posted: Fri Jan 10, 2014 3:26 pm
by Kateryna Grynko

Jay,

You can use this code to set label text manually:preAppery("labelName").text("your text");/pre
This is to copy other component's value:preAppery("labelName").text(Appery("other component name").text());/pre
And this one uses localStorage: prevar varName = Appery("some component name").text();
//here you set a value from a variable, but you can set any other value
Appery("labelName").text(localStorage.getItem("varName"));/pre
Don't forget to replace component and variable names with needed.


Page will not load in test

Posted: Fri Jan 10, 2014 3:50 pm
by Jay6395558

Thanks. This worked to some extent but I am only getting "null" to show up in the label. The new script is below. How to I get it to display the result as a number? Is it because the amount of characters are too long? Should I round the number so only 2 digits show after the decimal point?

var input = Appery('mobiletextinput_30').val();
var input2 = Appery('mobiletextinput_29').val();
var inputunit = Appery('mobileselectmenu_26').val();

var diameter = input*inputunit;

var lambda = 0.3/input2;

var ri = 180/(((3.1416*diameter)/lambda)+10);

var points=64800/(ri*ri);

var pointy = Appery("points").text(); //sets a value from variable, or you can set any other
var rils = Appery("ri").text();
Appery("mobilelabel_64").text(localStorage.getItem("pointy"));
Appery("mobilelabel_67").text(localStorage.getItem("ri"));


Page will not load in test

Posted: Fri Jan 10, 2014 5:55 pm
by Maryna Brodina

Hello! Instead prevar pointy = Appery("points").text(); //sets a value from variable, or you can set any other
var rils = Appery("ri").text();
Appery("mobilelabel_64").text(localStorage.getItem("pointy"));
Appery("mobilelabel_67").text(localStorage.getItem("ri"));/preuse preAppery("mobilelabel_64").text(pointy);
Appery("mobilelabel_67").text(ri);/pre