Page 1 of 1

Automatic Conversion Tool

Posted: Fri Jan 17, 2014 2:29 pm
by Jay6395558

Is there a way to create a javascript so a user can input a value into one of two or three fields and the result is automatically shown in the remaining blank fields without the user having to click a button to perform the action. I am trying to create a conversion tool that allows the user to input one unit of measurement which would trigger a calculation and the result of that calculation shows up in the other blank fields. See attached screenshot. I've also included a screenshot of how Google's conversion tool functions. It is what I want to do minus the ability to change units with a pull down option.

Image

Image


Automatic Conversion Tool

Posted: Fri Jan 17, 2014 2:51 pm
by Maryna Brodina

Hello! You can add calculation on Input event.


Automatic Conversion Tool

Posted: Fri Jan 17, 2014 2:56 pm
by Jay6395558

So, you do an input event for each input component so whichever field the user inputs a value a calculation is made and then displays in the other field?


Automatic Conversion Tool

Posted: Fri Jan 17, 2014 3:53 pm
by Jay6395558

Here is what I have tried based on your answer.
Image
Image
Image


Automatic Conversion Tool

Posted: Fri Jan 17, 2014 4:24 pm
by Jay6395558

I figured it out. I had to change .text to .val. It works now. Thank you.


Automatic Conversion Tool

Posted: Fri Jan 17, 2014 4:31 pm
by Kateryna Grynko

Hi Jay,

Thank you for the update, just was typing this solution :)


Automatic Conversion Tool

Posted: Fri Jan 17, 2014 11:05 pm
by Jay6395558

I am having some problems with a new script I have written for this same page.

var power = Appery('mobiletextinput_97').val();
var decibelresult = 10*(Math.log(power) / Math.LN10);
Appery("mobiletextinput_80").val(decibelresult.toFixed(2));
var decibel = Appery('mobiletextinput_80').val();
var voltageresult = Math.pow((decibel/20),10);
Appery("mobiletextinput_107").val(voltageresult.toFixed(2));

It seems that there is either something wrong with the syntax or the Math functions. I keep getting error messages when I inspect the element after testing.

Does everything look correct to you?


Automatic Conversion Tool

Posted: Sat Jan 18, 2014 12:19 am
by maxkatz

I'd debug this line of code:

var decibelresult = 10*(Math.log(power) / Math.LN10);

Insert some static value and see if you get the right result.


Automatic Conversion Tool

Posted: Mon Jan 20, 2014 4:44 pm
by Jay6395558

Thanks. After some additional debugging I resolved my problem