Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Javascript Help

I have the following script written to perform when I tap a button on a page. However, nothing is displaying in the three label boxes I have listed at the end of the script. This was working when I only had the "d" label box and then when I added the two otthers it stopped working. What am I doing wrong?

var freq = Appery('mobiletextinput_30').val();
var antdia = Appery('mobiletextinput_29').val();
var critang = Appery('mobiletextinput_80').val();
var scanwidth = Appery('mobiletextinput_97').val();
/*var adunit = Appery('mobileselectmenu_82').val();
var swunit = Appery('mobileselectmenu_26').val();

var diameter = antdiaadunit;
var width = scanwidthswunit;*/

var radians = critang * (Math.PI / 180);

var critrad = Math.tan(radians);

var lambda = 0.3/freq;

var lamconv = lambda/adunit;

var d = ((scanwidth-antdia)/2)/critrad;

var dlam = (((scanwidth-antdia)/2)/critrad)/lamconv;

Appery("mobilelabel_67").text(d.toFixed(2));
Appery("mobilelabel_101").text(antdia);
Appery("mobilelabel_102").text(dlam.toFixed(2)); Image

Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Javascript Help

Update*** I figured out what I did wrong for mobilelabel_67 and mobilelabel_102, but I still need to figure out mobilelabel_101. I want it to display the label and not the value of what I select. In this case, either Feet or Meters would show in this label. How do I do that? Also, is there a way to put a lambda symbol in a label component? I know how to do it in the html component but not the label component.

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

Javascript Help

Hi Jay,

In mobilelabel_101 you set a text from a variable 'antdia' that is entered in mobiletextinput_29.

Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Javascript Help

Thanks. I've figured just about everything out except this... Is there a way to put a lambda symbol in a label component? I know how to do it in the html component using code but not the label component. I'd prefer to not use the html component because there is a visible bar next to the html component when I test the app.

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

Javascript Help

Jay,

You can use any UTF-8 symbols in a label component, just paste it: λ.

ermias
Posts: 0
Joined: Wed Feb 11, 2015 11:16 pm

Javascript Help

hi jay. i am making my first app in appery and i need to to write a java script for my app but i don't have the skill to write in java script. but you seem to be very skilled with coding in java script as shown in your app.

i need to add almost same logic to my app as yours.

checkout my post so u can get a grip of it

https://getsatisfaction.com/apperyio/...

Return to “Issues”