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

Automatic Conversion Tool

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

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

Automatic Conversion Tool

Hello! You can add calculation on Input event.

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

Automatic Conversion Tool

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?

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

Automatic Conversion Tool

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

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

Automatic Conversion Tool

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

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

Automatic Conversion Tool

Hi Jay,

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

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

Automatic Conversion Tool

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?

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

Automatic Conversion Tool

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.

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

Automatic Conversion Tool

Thanks. After some additional debugging I resolved my problem

Return to “Issues”